Running Nagios plugins on clusters

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
pamplifier
Posts: 21
Joined: Wed May 13, 2015 7:31 am

Running Nagios plugins on clusters

Post by pamplifier »

I am building a plugin designed to run on the admin and leader nodes of a cluster, checking textfiles stored in the same locations on all the nodes (say, /tmp/testlog.txt). When it is done scanning through the file, it shows the file offset in the perfdata, to prove it doesn't have to scan from the beginning at each execution. I'm experimenting with what lines to keep in what config files to activate the plugin, and this is basically what I have on the admin node:

in the commands.cfg:

Code: Select all

#check_thing command definition
	define command {
        	command_name check_txt
	        command_line $USER1$/check_thing -w $ARG1$ -c $ARG2$
        }
in allservices.cfg

Code: Select all

define service{
        	use                     generic-service
	        hostgroup               all
	        service_description     check_txt
	        check_command           check_txt!5!10
}
in localhost.cfg

Code: Select all

define service{
        	use                             local-service
        	host_name                       localhost
        	service_description             check_txt
        	check_command                   check_txt!5!10
        }
And in the web interface, the check_thing check is shown under the admin node (localhost) and the leader nodes (leader1, leader2, etc). However, it is only checking the textfile stored in the admin node. I can tell because when I look at the perfdata for each check, they all reflect the same file offset after running, even though the txtfiles are of different sizes on each node.

I'm wondering if there is a step I'm missing to have the plugin check the other files. Looking at the default check_ping installed, it has no problem checking each node it's supposed to and reflecting their individual sets of data. I'm pretty sure I don't need the nrpe stuff for this, but the cluster documentation with nagios does not look all too relevant for my uses. Though I may just be misunderstanding the workflow.

Any help would be appreciated! Thank you
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Running Nagios plugins on clusters

Post by ssax »

You would need to use a check_nrpe command and have the plugins located on the other servers for them to run against files on those remote hosts. Let me dig up an example.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Running Nagios plugins on clusters

Post by ssax »

I assume these are Linux, do you have an agent installed on the remote hosts (NRPE, NCPA, NSCLient++)?

Code: Select all

./check_nrpe -H 192.168.5.232 -c check_thing
That would run the script on the remote hosts through NRPE and return the output to the XI server.

I suppose you could also use check_by_ssh to run the script through SSH or extend snmpd http://www.net-snmp.org/wiki/index.php/ ... ll_scripts but really NRPE is the most likely candidate that would give you more options.
Locked