Multiple line output


#1

Hello,

I’m in the process of writing yet another nagios plugin which checks TrendMicro’s Server Protect.

Server Protect has about 9 instances I need to check which I do.

The problem now comes when the instances don’t behave as they should I then issue a $STATE_CRITICAL

The problem is I wan to output in Nagios which services are running and which are not instead of just one line.
Right now I have:

some huge ifstatement that verifies serverprotect is not running as it should
echo "CRITICAL: TM SP not running as expected"
exit $STATE_CRITICAL

But I’d like something like:

some huge ifstatement that verifies serverprotect is not running as it should
echo "CRITICAL: TM SP not running as expected
          service something status is: $servicestatus
          service something2 ststus is: $servicestatus2
etc
"
exit $STATE_CRITICAL

I’ve tried html
injection in the echo statement

some huge ifstatement that verifies serverprotect is not running as it should
echo "CRITICAL: TM SP not running as expected <br>
          service something status is: $servicestatus
          service something2 ststus is: $servicestatus2
etc
"
exit $STATE_CRITICAL

and echo’ing 9 times but none of those methods seem to work.

some huge ifstatement that verifies serverprotect is not running as it should
echo "CRITICAL: TM SP not running as expected"
echo  "service something status is: $servicestatus"
echo  "service something2 ststus is: $servicestatus2"
etc
exit $STATE_CRITICAL

Is there a way to do this?


#2

I know Nagios 3 supports multiple line output but I’m talking Nagios 2.x here.

It would even be sufficient if service status splx output could be echo’d but it only takes the first line :frowning: