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 » Best UNIX script test to determine MQ server is running?

Post new topic  Reply to topic
 Best UNIX script test to determine MQ server is running? « View previous topic :: View next topic » 
Author Message
Tom Hogan
PostPosted: Tue Sep 24, 2002 8:50 am    Post subject: Best UNIX script test to determine MQ server is running? Reply with quote

Novice

Joined: 15 Aug 2001
Posts: 10

I have an application that connects directly to a local queue manager. The application will fail to start if the queue manager is not running. What is the best way to determine in a shell script if MQ server is running.
My application also requires Oracle, and I use a tnsping to check for Oracle. Is there something similar for MQ Series (or is it WebSphere MQ now)?
--Tom
Back to top
View user's profile Send private message
bduncan
PostPosted: Tue Sep 24, 2002 9:49 am    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

Well, if you wanna be a little more fancy, use perl and attempt to actually connect to the queue manager. If you fail, you will not only know the queue manager isn't running properly, but you'll know why (from the Reason code). If you want to stick strictly to shell scripts, then just use the 'runmqsc QMGRNAME' command. You can pipe the output somewhere (if it's not running properly you'll get an error message) and I also believe it will return a nonzero return code.
_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
sudhir
PostPosted: Fri Dec 27, 2002 1:49 am    Post subject: Reply with quote

Novice

Joined: 17 Dec 2002
Posts: 20
Location: Pune, India

hi
There is another way to find out that Queue manger is running or not
you just give command dspmq and pipe it to some txt file and just reading this file you can find that queue manager is running or not

sudhir
Back to top
View user's profile Send private message Yahoo Messenger
hopfe_de
PostPosted: Tue Jan 14, 2003 12:03 am    Post subject: small Programm Reply with quote

Acolyte

Joined: 03 Mar 2002
Posts: 58
Location: Frankfurt, Germany

You can write a small Programm.
This have only to make a MQCONN call.
After the connect you write the Completioncode to an enviroment variable, or return it.

edit:
Code:

/********** isup.c ***************/
#include <stdio.h>                   
#include <cmqc.h>                   
#include <cmqxc.h>                   
                                     
int main(int argc, char* argv[])     
{                                   
 long rc,cc,hconn;                                 
                                   
 if(argc < 2)                       
    return -1;                       

 MQCONN(argv[1],&hconn,&cc,&rc);     
                                     
 if(cc!=0)                           
    return (int)rc;                 
 else                               
    MQDISC(&hconn,&cc,&rc);                                               
 return 0;     /* return 0 if queuemanger is running */                       
}                                   


compile command
Code:

xlC isup.c /lib/libmqm.a -o isup


test script
QMGR ... is the name of the Queuemanager
Code:

up='./isup QMGR'
if($up == 0) then
   echo "running";
else
   echo "not running;
fi


This programm works, but it isn`t very much tested.

greez
Hopfe
Back to top
View user's profile Send private message Send e-mail AIM Address
aixmurderer
PostPosted: Sun Oct 05, 2003 10:23 pm    Post subject: Reply with quote

Newbie

Joined: 12 Aug 2002
Posts: 9

Use this in your shell script:

QMGR=`dspmq|awk '{ print$1 }'|cut -c 8-|sed -e 's/)//'`
MQSTAT=`dspmq|awk '{ print$2 }'|cut -c 8-|sed -e 's/)//'`

f [ "$MQSTAT" = "Running" ]
then
echo "QManager $QMGR $MQSTAT"
else
echo "QManager $QMGR not running"
do/something/here.sh #/usr/bin/su - mqm -c "/usr/bin/strmqm $QMGR"
fi

If you have more than 1 QManager you can play around with "head -1". "tail -1" etc.
Back to top
View user's profile Send private message
hopfe_de
PostPosted: Sun Oct 05, 2003 10:59 pm    Post subject: Reply with quote

Acolyte

Joined: 03 Mar 2002
Posts: 58
Location: Frankfurt, Germany

dspmq doesn't work with MQSeries 5.1 for AIX. dspmq is only supported in Websphere MQ Versions >= 5.3.

If you are using dspmq, and you have more than one QMGR running on the AIX you can use
Code:
dspmq -m <QMGR-NAME>

It's much easier than working with "tail -1".

greez
Hopfe
Back to top
View user's profile Send private message Send e-mail AIM Address
aixmurderer
PostPosted: Mon Oct 06, 2003 12:12 pm    Post subject: Reply with quote

Newbie

Joined: 12 Aug 2002
Posts: 9

We are running MQ ver 5.2 on AIX, it works 100%. Not sure about ver 5.1.
Back to top
View user's profile Send private message
hopfe_de
PostPosted: Mon Oct 06, 2003 12:25 pm    Post subject: Reply with quote

Acolyte

Joined: 03 Mar 2002
Posts: 58
Location: Frankfurt, Germany

I only tested 5.1 and 5.3. We don't have a running Version of 5.2.
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Performance Monitoring » Best UNIX script test to determine MQ server is running?
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.