cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor SAP Java instance from command line

Former Member
0 Kudos

Hello all - I'm currently working on the best method of monitoring a SAP Java stack from the command line. I want to be able to interrogate which services are up and running (or if there are none) with, ideally, a single line of UNIX script (to run on HP-UX and RHEL for us).

I have a sapcontrol command that isn't bad:

sappcontrol -prot NI_HTTP -nr ${CINO} -function J2EEGetProcessList -format script | awk '/^[0-9]* name:/ {printf "%s_", $(NF);} /^[0-9]* statetext:/ {print $(NF);

Note that ${CINO} is the CI instances number, in this case, being passed to the command.


This gives you the status of services... however during the SAP stack startup phase (which as you know can take a while for Java) there is a good period of time where this will hang and sapcontrol cannot bring back any results (even a negative one).  So I've been looking for an alternative.

The obvious alternative options are jcmon and jsmon.

However these are written as interactive tools so you have to be a bit clever - if you redirect a text document with the requisite commands to show services on screen and then exist - then you can grep that output. They seem not to hang at any point so in this regard it's superior to using sapcontrol.

The current command I'm testing goes like this:

/usr/sap/XXX/SYS/exe/run/jcmon pf=/sapmnt/XXX/profile/XXX_JC10_<server> <textfile 2>/dev/null | egrep 'dispatcher|server|SDM'

The text file contains this text:

20

0

0

These are the command line selections for "Local Administration Menu" (which shows services) and then "Exit" and "Exit"

The egrep then just takes the lines with the relevant services.

However.... you also seem to get these lines:

[Thr 01] Wed Jun 20 06:58:43 2012

[Thr 01] MtxInit: -2 0 0

At the top of the output, even though it seems to me that grep should clear them... I've tried redirecting both STDOUT and STDERR but this does not remove this text from the output.....

I'm very interested in either some analysis of what's going wrong with my jcmon command - or other ways of monitoring services reliably from the local UNIX command line. I've tried jsmon but it doesn't seem to respond as well to this technique - I keep getting looped output.

Any ideas SCNers?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

NB Just expanding my testing of using jsmon with a siple piped echo I still get an infinite loop that you have to cancel

e.g.

echo "jsmon view" | jsmon pf=<profile>

Any idea on why would be appreciated. JSMON seems to be superceding JCMON from what I've read so I'd like to use it, but evidently it's not optimised for the command line like sapcontrol is....

Perhaps there's a way to stop sapcontrol from hanging during a check in the the startup phases.......