check_by_ssh and currently logged users

Marian Zurek Marian.ZUREK at cern.ch
Wed Mar 5 17:28:46 CET 2003


Hi,

I wanted to see in the Nagios monitoring window the currently running processes.
For that purpose I worked out the command as follows:

/bin/ps aux | egrep -vw 'USER|root|postfix|daemon|rpc|xfs' | cut -f1 -d\  | sort 
| uniq -c | tr -s '\t \n' '  ,'

and put it as an argument to the check_by_ssh plugin, so the whole command_line 
as specified in the checkcommands.cfg file looks like following:

$USER1$/check_by_ssh -H $HOSTADDRESS$ --command='/bin/ps aux' | egrep -vw 
'USER|root|postfix|daemon|rpc|xfs' | cut -f1 -d\  | sort | uniq -c | tr -s '\t 
\n' '  ,'


but it doesn't seem to work properly. The whole output from the 'ps aux' command 
seem to be cut to the one line only. Is that expected behaviour ?

The attempt of processing the 'ps aux' output on the remote machine with the 
command:

./check_by_ssh -H remote_hostA --command='/bin/ps aux | egrep -vw 
'USER|root|postfix|daemon|rpc|xfs' | cut -f1 -d\  | sort | uniq -c | tr -s '\t 
\n' '  ,''

ends up with the errors like


bash: root: command not found
bash: xfs | cut -f1 -d\  | sort | uniq -c | tr -s t: command not found
bash: rpc: command not found
bash: daemon: command not found
postfix/postfix-script: fatal: usage: postfix start (or stop, reload, abort, 
flush, or check)

Can you suggest what technique should I use to achieve my results. I would 
prefer to do it with minimal touch of controlled hosts if possible.
I will be also thankful for other ideas/hints.
Thanks in advance for your attention.


Regards,
Marian



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list