Status Information

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Status Information

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Status Information

Post 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.
Former Nagios Employee.
me.
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Re: Status Information

Post 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
)
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Status Information

Post 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?
Former Nagios Employee
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Re: Status Information

Post by haile711 »

hey Kennedy,
Yea i want all 3 result to show up in the "status information"
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Status Information

Post 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.
Former Nagios Employee
Locked