Process list in test properties fragmentary

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
ataudte
Posts: 28
Joined: Wed Apr 23, 2008 3:40 am
Location: FFM, Germany

Process list in test properties fragmentary

Post by ataudte »

Hello KS-Soft team,
hello all the other enthusiastic HostMon users,

I think, you can help me.
I have to monitor processes of some Solaris machines. The list in the test properties isn't accord with the processes at the machine, if I'am using the "ps" command in the prompt.

E.g. there are different Orcale processes running, but I just get "oracle" in the list of the "Process" test. What is the difference between the "oracle" process and the other processes, which are using Oracle for their databases?

I hope somebody has experience with Oracle on Sun Solaris and the processes. At the moment we are using a shell script to check the processes by the machine itself. We could use this script in the "Shell Script" test of HostMonitor, but I want to know, why the list generated by the "ps" command is distinct with the list in the test properties.

Regards,
ataudte
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Not sure I understand the problem. What exactly means "isn't accord with the processes at the machine"? What exactly processes are missed from the list?

There are 2 files in RMA folder that help to perform Process tests on UNIX systems: proccnt.sh proclist.sh
On Sun systems the following command used to list processes: "ps -eo fname"
You may easily modify proccnt.sh proclist.sh to fit your needs.

Regards
Alex
ataudte
Posts: 28
Joined: Wed Apr 23, 2008 3:40 am
Location: FFM, Germany

Post by ataudte »

Hello Alex,

I will give you a little explanation.
I have to know, whether a process with its specific parameters is running, e.g.

Code: Select all

nsrlcpd -s server4711 -N 1 -n 1
nsrmmd -n 2 -s server4711
With the "Process" test of HostMonitor, I just get "nsrlcpd" and "nsrmmd", but there are processes with multiple instances. They differ in their parameters.

My solution:
At the RMA a config file is placed. In this file stands all the processes with their parameters I want to monitor. I insert the following script in the "Script Manager". The committed parameter is the path to the config file at the machine.

Code: Select all

#!/usr/bin/bash
#---Error Treatment---
if [ $# -eq 0 ]; then
   echo "ScriptRes:Bad:Missing Parameters!"
   exit
else
   #---set config-file---
   if [ ! -f "$1" ]; then
      echo "ScriptRes:Bad:Config File ($1) does not exist"
      exit
   else
      cfg_file=$1
   fi
fi
#
#######################
# Check Proc Function #
#######################
check_proc() {
 if [ -z $1 ]; then
    echo "ScriptRes:Bad:No Program specified"
    exit
  fi
  ps -ef | grep -v grep | grep "$*" > /dev/null
  if [ $? -eq 0 ]; then
    return 0
  else
    return 1
  fi
}
#
#################
# Main Funktion #
#################
main_prog() {
  reply=""
  while read line; do
    proc=`echo $line`
    check_proc $proc
    if [ $? -ne 0 ]; then
      reply="$reply \"$proc\""
    fi
  done < $cfg_file
  if [ "$reply" != "" ]; then
    echo "ScriptRes:Bad:Process(es)$reply not running"
  else
    echo "ScriptRes:Ok:All processes active"
  fi
}
#
#
#######
# Run #
#######
main_prog
#-------------------------------------------------------------------------------
Reply (e.g.):

Code: Select all

Process(es) "nsrlcpd -s server4711 -N 1 -n 1" "nsrmmd -n 2 -s server4711" not running
Now I can use the reply of the test to inform the admin of the Solaris machines, which processes aren't runnig at the respective server.

I think it could be helpful to extend the "Process" test of HostMonitor with the needed parameters. Thus I could differentiate between several instances of one process.

Regards,
ataudte
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I see.
As I said you may easily modify proccnt.sh proclist.sh to fit your needs. These files comes with agent and located in the same directory
E.g. you may change ""ps -eo fname" to "ps -ef"

Regards
Alex
ataudte
Posts: 28
Joined: Wed Apr 23, 2008 3:40 am
Location: FFM, Germany

Post by ataudte »

Hello Alex,

you are right, but now we can monitor all processes in one tests. I might have use the proclist.sh as a suggestion. The effort would been the same.

Thanks for your time,
ataudte
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

but now we can monitor all processes in one tests
Yes, you are right - Process test cannot do that.
You created script that can checks all processes, something similar to "Dominant Process" test method designed for Windows only.

I think you may publish your script in "Library" forum. It can be useful for some people.

Regards
Alex
Post Reply