Page 1 of 1

Status Information

Posted: Wed Jan 20, 2016 3:13 pm
by haile711
Hey guys,
I have a situation, where I have a process check for a server, and the status is "Critical" for one of the process but not showing up under "status information" column. I have to click on the process to see which one of the processes is critical

Re: Status Information

Posted: Wed Jan 20, 2016 3:42 pm
by hsmith
What plugin are you using? It looks like you have three lines of output, and it's only showing the first one. This is intended behavior to keep the status screen from looking too messy.

Re: Status Information

Posted: Wed Jan 20, 2016 3:56 pm
by haile711
Hey Smith,

here is the plugin that i got

Code: Select all

#!/bin/bash
#Script to check the ownwer of processes
exit_var=0
cat /usr/local/nagios/libexec/std_processes.cfg | ( while read line
do
process=`echo ${line} | sed 's/^.\|[a-z][A-Z] /\[&]/g'`
tmp_process=`ps aux | grep ${process} | grep -v root | grep -v $0`
ps_user=`echo ${tmp_process} | awk '{print $1}'`
ps_stat=`echo ${tmp_process} | awk '{print $11}'`

if [[ ! -z $tmp_process ]]

then
case $ps_user in
        "fsgapp")
        output_string="OK - $ps_user is the owner for ${line}"
        echo $output_string
        exitvar=0
        ;;
        *)
        output_string="CRITICAL -  $ps_user is the owner for ${line}"
        echo $output_string
        exitvar=2
        ;;
esac

elif [ -z $tmp_process ]
then
        output_string="CRITICAL -  $line Process is not running"
        echo $output_string
        exitvar=2
fi
exit_var=$(( $exit_var + $exitvar ))
done
if [[ $exit_var -gt 0 ]]; then
        new_exitvar=2
else
		new_exitvar=0
fi
exit $new_exitvar
)

Re: Status Information

Posted: Wed Jan 20, 2016 4:20 pm
by rkennedy
Ah, there may be an issue with the bash script then.

Should the bash script be returning all 3 results, or are you looking for it to only return one of those results?

Re: Status Information

Posted: Wed Jan 20, 2016 4:30 pm
by haile711
hey Kennedy,
Yea i want all 3 result to show up in the "status information"

Re: Status Information

Posted: Wed Jan 20, 2016 4:41 pm
by rkennedy
Ok - a bit different as this usually isn't how a plugin is setup, but here's what needs to be done.
- Each plugin can only exit once, so you will need to decide how this script will exit properly (as right now, there is 1 OK and 2 CRIT )
- From there, instead of echo $output_string, I would assign each $output_string to a new $var. Then, at the end of your script, echo the results before the scripts exits with echo $var1 $var2 $var3. This will have all of the results on one line, rather then 3.