Nagios command definition files

0

Im following the tutorial from this page. Writing Custom Nagios Plugins

Everything is working fine my only problem is that the first config file your supposed to edit is the command-plugins.cfg file and I cant find the file. I did the following command

find / -name "*cfg"

and the results showed all my nagios cfg files but command-plugins.cfg was not one of them.

So I continued on with the tutorial and did everything else. Nagios tried to perform my custom service check but this error returned

(Return code of 127 is out of bounds - plugin may be missing) 

So im assuming that the command definition still has to be made but where? Does anyone know how to resolve this?

citizen2191629

Posted 2014-04-23T17:25:32.207

Reputation: 13

latest nagios version? latest nagios-plugins version? – Marcel – 2014-04-23T17:29:30.783

Yes this is a brand new install I did last week. – citizen2191629 – 2014-04-23T17:32:42.567

Answers

1

You can make changes to any of the *.cfg files that Nagios knows about — you do not have to actually have one called command-plugins.cfg. The important thing about a command definition is that it has the right format, e.g.:

define command {
    command_name    an_alias_to_the_command
    command_line    /pathto/your_command_script --arg1 --arg2
}

Nagios will use one major config file to determine all other files to load. For me it is /etc/nagios/nagios.cfg. This file contains directives, such as cfg_file and cfg_dir to load either an individual file, or all *.cfg files in a directory.

I prefer to split my commands file based on my own categories, so mine has an entry in it:

cfg_dir=/etc/nagios/commands

This means I will load all the *.cfg files in my /etc/nagios/commands directory.

You should look at your equivilent nagios.cfg file to determine all the places it will load *.cfg files from — you should be able to determine which file to edit or where to create a new file from there.

jimbobmcgee

Posted 2014-04-23T17:25:32.207

Reputation: 622