Page 1 of 1

Gather script output

Posted: Tue Jul 09, 2013 7:50 am
by test541
Hello all.
I'd like to integrate some data from scripts installed on monitored servers. I'd like also send the data via ssh tunnel with -L local port forwarding (it is not a problem).
The agent has perl scripts writing to the socket. Simply like in http://blog.gulfsoft.com/2008/03/brief- ... -data.html
The output data is formated in following manner "ID|Application_group|Name_of_service|severity|Summary" for example:
KL:001|ERP_System|ERP.OS.CPU|critical|CPU usage is in critical state

Can you help me how to handle such simple text content into Nagios?
Is it possible to map "Name_of_service" to Nagios GUI service name?
I don't want to use any specialized agents. Only existing perl scripts on Unix/Windows(cygwin) machines.
Thx.

Re: Gather script output

Posted: Tue Jul 09, 2013 11:51 am
by slansing
Have you taken a look at the plugin development guidelines? They should be of great help:

http://nagiosplug.sourceforge.net/devel ... lines.html

Re: Gather script output

Posted: Wed Jul 10, 2013 12:32 am
by test541
I wasn't clear enough.
Plugin guide doesn't help me. It is concentrated on executing scripts on local and remote machines. Initiated by Nagios.
I have another situation where scripts on remote machines are executed by their own shedulers. Their output can (or cannot) be generated, according to set thresholds. Ie. events are "pushed", not "pulled".
For example: CPU is overloaded - output is sent, CPU is in normal state - no output.
In Nagios, I'd like only gather events from the agents and present it in GUI.
I thought about parsing messages comming on a TCP port on Nagios server, and after that slicing information based on delimiters into required Nagios fields.

Re: Gather script output

Posted: Wed Jul 10, 2013 10:39 am
by abrist
I think the best solution for your environment would be writing to the nagios command pipe and submitting a passive result. Your current scripts would need to be modified (or call a new script) to ssh to the nagios server and write to the command pipe. You could use nfs or the like to share the command pipe file to make it easier for those servers to write to it. Or create an even more custom solution to get the checks to nagios. I would have suggested one of our passive agents, but you specifically stated you do not want to use an agent. Below you will find a link fest for the information necessary to implement this type of custom reporting system:

http://nagios.sourceforge.net/docs/3_0/ ... hecks.html
http://nagios.sourceforge.net/docs/3_0/extcommands.html

http://old.nagios.org/developerinfo/ext ... ndlist.php
http://old.nagios.org/developerinfo/ext ... and_id=115
http://old.nagios.org/developerinfo/ext ... and_id=114