Author |
Message
|
mqquester |
Posted: Tue Jan 06, 2004 9:17 am Post subject: How to monitor QMgr by application? |
|
|
Apprentice
Joined: 27 Nov 2003 Posts: 35
|
Hi buddy,
Do you know how to program a small application to monitor QMgr? How could I know currently the QMgr is running or not? any library provided?
Thanks in advance |
|
Back to top |
|
 |
Michael Dag |
Posted: Tue Jan 06, 2004 9:24 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
what version of MQ, which platform? Just running or not, to report?
Michael |
|
Back to top |
|
 |
mqquester |
Posted: Tue Jan 06, 2004 9:32 am Post subject: |
|
|
Apprentice
Joined: 27 Nov 2003 Posts: 35
|
MQ5.2 on UNIX & windows.
I hope if QMgr is not running or any error, an e-mail can inform me. |
|
Back to top |
|
 |
Prahasith |
Posted: Tue Jan 06, 2004 9:46 am Post subject: |
|
|
 Disciple
Joined: 16 May 2003 Posts: 184 Location: Kansas City
|
you can write a shell script or perl script that checks for
queue manager agents amqzlaa0 and sends an e-mail if it doesn't exist. put the shell script in the cron jobs so that it checks periodically |
|
Back to top |
|
 |
mqquester |
Posted: Tue Jan 06, 2004 9:59 am Post subject: |
|
|
Apprentice
Joined: 27 Nov 2003 Posts: 35
|
Thanks Prahasith, I found amqzlaa0.exe file. But where can I find description of this file? What does this file do?
For Windows, what can I do? |
|
Back to top |
|
 |
Prahasith |
Posted: Tue Jan 06, 2004 10:13 am Post subject: |
|
|
 Disciple
Joined: 16 May 2003 Posts: 184 Location: Kansas City
|
AMQZLAA0 Queue manager agents perform the bulk of the work for applications that connect to the queue manager using MQCNO_STANDARD_BINDING |
|
Back to top |
|
 |
mqquester |
Posted: Tue Jan 06, 2004 10:23 am Post subject: |
|
|
Apprentice
Joined: 27 Nov 2003 Posts: 35
|
So it means if AMQZLAA0 does not exist which means there is some errors on QMgr. The application is just programmed for monitoring the existing of AMQZLAA0.exe file? |
|
Back to top |
|
 |
Prahasith |
Posted: Tue Jan 06, 2004 10:31 am Post subject: |
|
|
 Disciple
Joined: 16 May 2003 Posts: 184 Location: Kansas City
|
hey sorry
you should check for amqzxma0 not AMQZLAA0
from this you can say whether queue manager is running or not
find_qmgrs_running {
my $my_tmp = " ";
#$email_txt = $email_txt . "find_qmgrs_running\n";
log_msg("find_qmgrs_running\n");
@list_amqzxma0 = `ps -ef|grep amqzxma0| grep -v grep `;
$ctr = 0;
foreach $s (@list_amqzxma0) {
if ($ctr == 0) {
log_msg(" Queue managers currently running:\n");
$email_txt = $email_txt . "\n Queue managers currently running:\n";
}
chomp($s);
@ps_list = split(/[\-][m]/, $s); # split on the -m string
$qmgr_name = @ps_list[1];
$qmgr_name =~ s/^\s+//;
$qmgr_name =~ s/\s+$//;
log_msg(" $qmgr_name\n");
$email_txt = $email_txt . " $qmgr_name\n";
$ctr++;
$qmgrs_running = "Y";
push(@running_qmgrs, $qmgr_name);
}
if ($ctr == 0) {
log_msg(" No queue managers running\n");
$email_txt = $email_txt . " No queue managers running\n";
$qmgrs_running = "N";
}
log_msg("\n");
return($qmgrs_running);
} |
|
Back to top |
|
 |
vennela |
Posted: Tue Jan 06, 2004 10:46 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
You are above version 5.2 you can use dspmq instead.
Here is a thread that discusses on how you do that.
Monitoring MQ using dspmq |
|
Back to top |
|
 |
Prahasith |
Posted: Tue Jan 06, 2004 11:02 am Post subject: |
|
|
 Disciple
Joined: 16 May 2003 Posts: 184 Location: Kansas City
|
with venny's solution you can probabaly right a batch script for windows too using dspmq |
|
Back to top |
|
 |
mqquester |
Posted: Tue Jan 06, 2004 11:40 am Post subject: |
|
|
Apprentice
Joined: 27 Nov 2003 Posts: 35
|
|
Back to top |
|
 |
markt |
Posted: Tue Jan 06, 2004 3:14 pm Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
Do NOT attempt to monitor MQ from looking at whether a named process is running. If the process does not exist, then the qmgr is not up; however you can determine nothing reliable from the existence of a process. |
|
Back to top |
|
 |
kman |
Posted: Tue Jan 06, 2004 7:30 pm Post subject: |
|
|
Partisan
Joined: 21 Jan 2003 Posts: 309 Location: Kuala Lumpur, Malaysia
|
QM status is kept in the registry for Windows, and in the qmstatus.ini on Unix. You can write a program to look up for the registry values, or for qmstatus content.
For mq5.3 you can make use of dspmq command on both platform. I can't remember where does mq 5.2 on windows keep the status, I think it should be in the registry too.
I have to agree that looking up for the amq process is not enough to tell the status, except for whether it is running or not.
You can always write a simple program to connect to the QM, that way it'll return whether it is running, unavailable or not found. Or run a script against runmqsc command output. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Jan 07, 2004 8:11 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
On Windows, you can also:
amqmdain status QMGR |
|
Back to top |
|
 |
JasonE |
Posted: Wed Jan 07, 2004 9:38 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
I wouldnt trust the qmstatus as a way of monitoring the health of a qmgr - If you kill -9'ed all the Unix processes making up MQ, who would update the qmstatus.ini to reflect that...!
Dspmq is a lot better, and I'm sure there are other ways of doing it too, as well as vendor products.
The real question you need to ask yourself is what you regard as a healthy qmgr! ie the qmgr may work fine but channel problems may make your application fail, or a deadlock in MQ stops anything from working but it appears up and running from dspmq etc. Sending a round trip dummy message, for example, may be one way of checking the way the application would work etc
I would identify your requirements for a working system and start there. |
|
Back to top |
|
 |
|