Gather script output

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
test541
Posts: 14
Joined: Wed May 22, 2013 4:20 am

Gather script output

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Gather script output

Post 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
test541
Posts: 14
Joined: Wed May 22, 2013 4:20 am

Re: Gather script output

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Gather script output

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked