the output consists of 100+ apps, with each one of them returning their status.
Here is what I need -
Want to create a wrapper script which returns a cumulative summary. I need a step by step instructions on how to hook a script like this into nagios?
What I desire -
Instead of a cumulative result, can I display the result in Nagios on a per application basis using this one script (and a wrapper script on top of it)?
I would need clear instructions here.
If you can also provide me with a wrapper script for reference in relation to how the result can be presented to Nagios that would be great.
Please help!!
Thanks,
Jack
---------- Post updated at 05:59 PM ---------- Previous update was at 03:14 PM ----------
I have a script which basically does a wget on a set of URLs and returns the health of the application in the format that I gave above.
I want to plug this into Nagios so that I can see the output within Nagios 3.x.
Do you know how to achieve that?
Also what I desire is that from the output I can create a single check for each of the apps as if they are different checks (but in this case being returned from a single script).
Then use a generic script to evaluate the status of the service. (based in rdcwayx' code):
#!/bin/bash
if [ -n "$(awk 'BEGIN{RS=""}/'$1'/{a[$3 FS $6]++}END{for (i in a) print i , a}' your_file)" ]; then
echo "App is OK" && exit $0;
else
echo 'App down!' && exit 2;
else
echo "Unknown Status" && exit 3;
fi
You might need to adjust paths according to your nagios.cfg file.