ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Performance Monitoring » MQ Prometheus Windows Service

Post new topic  Reply to topic Goto page 1, 2  Next
 MQ Prometheus Windows Service « View previous topic :: View next topic » 
Author Message
mrk.for.dev
PostPosted: Fri Apr 16, 2021 7:52 am    Post subject: MQ Prometheus Windows Service Reply with quote

Novice

Joined: 11 Jan 2021
Posts: 23

Hello,

I try to create a service in the QM to start and stop the mq_prometheus collector like in the following link but on Windows: https://github.com/ibm-messaging/mq-metric-samples
For the "Stop command", I found the equivalent on Windows which is : taskkill.exe /F /PID mq_prometheus.exe

Except I get the following error when I try to stop it:
AMQ5019E: Unable to access program 'C:\Windows\System32\taskkill.exe /F /PID mq_prometheus.exe'.

some help please?
Back to top
View user's profile Send private message
markt
PostPosted: Fri Apr 16, 2021 11:32 am    Post subject: Reply with quote

Knight

Joined: 14 May 2002
Posts: 502

The help info for taskkill says that the /pid points at a process id (eg 1234) not a program name. You should probably be looking at using the /im flag instead.
Back to top
View user's profile Send private message
mrk.for.dev
PostPosted: Sat Apr 17, 2021 8:45 am    Post subject: Reply with quote

Novice

Joined: 11 Jan 2021
Posts: 23

Yes, I am sorry the command is:
taskkill.exe /F /IM mq_prometheus.exe
Back to top
View user's profile Send private message
mrk.for.dev
PostPosted: Sun Apr 18, 2021 4:19 am    Post subject: Reply with quote

Novice

Joined: 11 Jan 2021
Posts: 23

but even with this command, MQ can't execute it :/ with the same error :
IBM MQ cannot process the request because the executable specified cannot be started. (AMQ4160)
IBM MQ cannot process the request because the executable specified cannot be started. (AMQ4160)
The IBM MQ user does not have sufficient access to execute the program.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Sun Apr 18, 2021 4:51 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

mrk.for.dev wrote:
but even with this command, MQ can't execute it :/ with the same error :
IBM MQ cannot process the request because the executable specified cannot be started. (AMQ4160)
IBM MQ cannot process the request because the executable specified cannot be started. (AMQ4160)
The IBM MQ user does not have sufficient access to execute the program.

Which user is attempting to execute the program?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
mrk.for.dev
PostPosted: Sun Apr 18, 2021 5:01 am    Post subject: Reply with quote

Novice

Joined: 11 Jan 2021
Posts: 23

User(MUSR_MQADMIN)
Back to top
View user's profile Send private message
bruce2359
PostPosted: Sun Apr 18, 2021 5:56 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

mrk.for.dev wrote:
User(MUSR_MQADMIN)

How did you determine that this is, in fact, the user attempting to execute the program?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
mrk.for.dev
PostPosted: Mon Apr 19, 2021 11:19 pm    Post subject: Reply with quote

Novice

Joined: 11 Jan 2021
Posts: 23

I finally managed to find an explanation.
In fact, the user MUSR_MQADMIN does not have the right to kill a process by its name but rather by its PID.
To solve the problem, a simple batch script can find the PID according to the port used and then kill it with: C:\Windows\System32\taskkill.exe /F /PID <PID_MQ_PROMETHEUS>
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Apr 20, 2021 4:40 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

For the benefit of others, how did you discover that MUSR didn’t have execution authority?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
hughson
PostPosted: Tue Apr 20, 2021 9:52 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

mrk.for.dev wrote:
I finally managed to find an explanation.
In fact, the user MUSR_MQADMIN does not have the right to kill a process by its name but rather by its PID.
To solve the problem, a simple batch script can find the PID according to the port used and then kill it with: C:\Windows\System32\taskkill.exe /F /PID <PID_MQ_PROMETHEUS>

You don't need to write a batch script to find the PID, the queue manager has an insert which it will replace with the PID of the program that was started as a SERVICE object.

So you should be able to make your STOP command something like:

Code:
taskkill.exe /F /PID +MQ_SERVER_PID+


The +MQ_SERVER_PID+ is a token representing the process id of the process started by the STARTCMD and STARTARG arguments.

See Running the Trigger Monitor as a SERVICE for an example of doing this with the trigger monitor that I wrote a little while back.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
markt
PostPosted: Tue Apr 20, 2021 11:17 pm    Post subject: Reply with quote

Knight

Joined: 14 May 2002
Posts: 502

One thing you have to be careful of on Windows is how the program is actually started. Using +MQ_SERVER_PID+ is fine where the real program is started directly from the service definition.

But in many cases, what people do is have a batch program/script that wraps around the main program. Perhaps setting up additional environment variables, or expanding beyond the length limits of the STARTARG attribute. That's often particularly needed when running Java programs where you need to setup CLASSPATHs etc. So that the pid as seen by the qmgr refers to the script rather than the real program.

At least the Windows taskkill program does have the /T option to kill children of the nominated process, so that should work here. But you may need to know a bit more about the overall process structure to be sure that is what you want.

On Unix it's less of an issue because the last line of a setup script can use "exec" so that the invoked program inherits the pid from the script and +MQ_SERVER_PID+ works directly.
Back to top
View user's profile Send private message
mrk.for.dev
PostPosted: Wed Apr 21, 2021 1:08 am    Post subject: Reply with quote

Novice

Joined: 11 Jan 2021
Posts: 23

I think Chevalier has already said what I wanted to say.

In fact, the program is run in a batch file. The queue manager sets MQ_SERVER_PID to the PID of the launched batch and not the PID of the program launched in the batch. And this is not enough.

On Unix, we don't have this problem. I tested it and it works without fail.

Poobah: You can see this in the MQ logs. When the process does not stop, an error is traced with information like the user who executed the command.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Apr 21, 2021 7:07 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

mrk.for.dev wrote:
Poobah: You can see this in the MQ logs. When the process does not stop, an error is traced with information like the user who executed the command.

Rather than telling us that an error is traced, please post here complete error that you saw in the logs - especially the message ID (AMQ.......).
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
mrk.for.dev
PostPosted: Wed Apr 21, 2021 7:39 am    Post subject: Reply with quote

Novice

Joined: 11 Jan 2021
Posts: 23

Code:
18/04/2021 14:52:14 - Process(3772.1) User(MUSR_MQADMIN) Program(amqzmgr0.exe)
                      Host(DESKTOP-2J0TVOF) Installation(Installation1)
                      VRMF(9.2.1.0) QMgr(QMMONITORED)
                      Time(2021-04-18T12:52:14.372Z)
                      CommentInsert1(C:\Windows\System32\taskkill.exe /F /PID 11856)
                     
AMQ5019E: Unable to access program 'C:\Windows\System32\taskkill.exe /F /PID
11856'.

EXPLANATION:
A request was made to execute the program C:\Windows\System32\taskkill.exe /F
/PID 11856, however the operation was unsuccessful because the program could
not be found in the specified location.
ACTION:
Check the definition of the service specifies the correct and full path to the
program to run. If the path is correct then verify that the program exists in
the specified location and that IBM MQ userid has permission to access it.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Apr 21, 2021 10:16 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3252
Location: London, ON Canada

Can you dump out the service object definition and post it here? I'm curious how you have STOPCMD and STOPARG configured.
i.e.
Code:
dis service({service_name})


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Performance Monitoring » MQ Prometheus Windows Service
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.