Standard Nagios check programs are stored in /usr/local/nagios/libexec. Which folder do I use to store my custom check programs?
Defining my check program. Does it get defined it in /usr/local/nagios/etc/commands.cfg or do I define it in a new file /usr/local/nagios/etc/static/myKoolCommands.cfg?
I also have to notify Nagios of myKoolCommands.cfg. Do I insert cfg_file=/usr/local/nagios/etc/static/myKoolCommands.cfg into /usr/local/nagios/etc/nagios.cfg or some other file?
Restart Nagios with "service nagios restart"?
Is there anything else I have to do to get Nagios to recognize my program?
Thank you
Where to store custom check programs
Re: Where to store custom check programs
Wherever you want. I usually create a folder inside libexec for my custom check scripts.moose wrote:Standard Nagios check programs are stored in /usr/local/nagios/libexec. Which folder do I use to store my custom check programs?
Either once again. Just remember that any new config you create has to be declared with and include statement in the nagios.cfg file.moose wrote:Defining my check program. Does it get defined it in /usr/local/nagios/etc/commands.cfg or do I define it in a new file /usr/local/nagios/etc/static/myKoolCommands.cfg?
Exactly.moose wrote:I also have to notify Nagios of myKoolCommands.cfg. Do I insert cfg_file=/usr/local/nagios/etc/static/myKoolCommands.cfg into /usr/local/nagios/etc/nagios.cfg or some other file?
Yep.moose wrote:Restart Nagios with "service nagios restart"?
As always, it depends on the plugin in question.moose wrote:Is there anything else I have to do to get Nagios to recognize my program?
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.
"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.
Re: Where to store custom check programs
Nagios does not offer my plugin in the CGI. CCM> Services> AddNew> CheckCommand combo box.
As a test I have duplicated and renamed one of the plugins that comes with Nagios check_mssql to become check_ts. Here's what I've done do far.
Made a sub-folder for the plugin /usr/local/nagios/libexec/ia
Copied /usr/local/nagios/libexec/check_mssql into /usr/local/nagios/libexec/ia/check_ts
Created a new command file /usr/local/nagios/etc/static/ia_commands.cfg
File /usr/local/nagios/etc/nagios.cfg already has cfg_dir=/usr/local/nagios/etc/static which loads my ia_commands.cfg. No changes to nagios.cfg were made. I've also tried specifing ia_commands.cfg in nagios.cfg and got an error for duplicate definitions.
The pre-flight check found ia_commands.cfg and shows no warnings and no errors.
"service nagios restart" stopped and started without problems.
I reloaded the CGI page.
Is there some other setting I have to make?
As a test I have duplicated and renamed one of the plugins that comes with Nagios check_mssql to become check_ts. Here's what I've done do far.
Made a sub-folder for the plugin /usr/local/nagios/libexec/ia
Copied /usr/local/nagios/libexec/check_mssql into /usr/local/nagios/libexec/ia/check_ts
Created a new command file /usr/local/nagios/etc/static/ia_commands.cfg
Code: Select all
# Contents of ia_commands.cfg
define command {
command_name check_ts
command_line $USER1$/ia/check_ts -H $HOSTADDRESS$ $ARG1$
}
The pre-flight check found ia_commands.cfg and shows no warnings and no errors.
"service nagios restart" stopped and started without problems.
I reloaded the CGI page.
Is there some other setting I have to make?
Re: Where to store custom check programs
Can you run the check from the cli?
http://assets.nagios.com/downloads/nagi ... ios_XI.pdf
http://assets.nagios.com/downloads/nagi ... ios_XI.pdf
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.
"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.
Re: Where to store custom check programs
Thank you.
I followed the PDF and Nagios recognizes the plugin and it appears in the combo box. Adding the plugin manually was a waste of time. I'll just use the CGI from now on and be resigned to never knowing why the manual method didn't work.
... the plugin did run on the CLI because it was a standard plugin; just renamed.
I followed the PDF and Nagios recognizes the plugin and it appears in the combo box. Adding the plugin manually was a waste of time. I'll just use the CGI from now on and be resigned to never knowing why the manual method didn't work.
... the plugin did run on the CLI because it was a standard plugin; just renamed.
Re: Where to store custom check programs
I'm glad your problem has been resolved.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Where to store custom check programs
With XI, it is best to stick to the web ui for most things. Not to say that the static directory doesn't have a place for some installs, but if you can use the ui, it is better as then you have the db backend and some advanced validation and logic for checking your configs.
Glad to hear you got it working. Locked.
Glad to hear you got it working. Locked.
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.
"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.