New to Nagios. Installing Custom Plugin Problem

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.
omar
Posts: 15
Joined: Fri Jan 24, 2014 12:06 pm

Re: New to Nagios. Installing Custom Plugin Problem

Post by omar »

@millisa.

Thank you for the vast amount of information you supplied. I feel a little stupid thinking that the min and max values of the WeatherGoose were thresholds that gave warnings of the Weathergoose. When I previously asked this to my supervisor, about why previous logs showed the alarm tripping when the values where within the min and max threshold, he was puzzled as well. While yes, I am a student, this project was not assigned to me by an instructor of one of my classes. Instead I work for the University's Enterprise Infrastructure department, similar to work study.

Per your information provided, I did change the define host, services, and command to the following

Code: Select all

define host{
        use                          linux-server
        host_name               localhost
        alias                        localhost
        address                   127.0.0.1
        }

define service{
        use                         generic-service
        host_name              localhost
        description              Check Calculus Temperature 
        check_command      WeatherGooseII.pl
        }

define command{
   command_name        WeatherGooseII.pl
   command_line           WeatherGooseII.pl –H $HOSTADDRESS$ -p #or /usr/local/nagios/libexec/WeatherGooseII.pl –H 127.0.0.1 -p
}
define host and service are located in /usr/local/nagios/etc/objects/WeathGooseII.cfg
and defince command is located in /usr/local/nagios/etc/objects/command.cfg

I still cannot get Nagios to produce any info on the webinterface. I tried running:
nagios -v /usr/local/nagios/etc/nagios.cfg
but get a bash:nagios:command not found error. So I ran:
/etc/init.d/nagios configtest
and got message that "Things look OK"

I'll be reading the articles in the links that you provided, to work on my perlscript. But once again, thanks for the info. I know that once I figure this one little step out, that I'll definitely be more knowledgable to be able to handle configuring Nagios to monitor the WeatherGoose remotely.
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: New to Nagios. Installing Custom Plugin Problem

Post by millisa »

When you say you aren't getting any info on the web interface - is your check just not showing up at all? or is it showing up with an unknown status, or critical status?
If it's not showing up at all - the nagios process doesn't read the config on the fly. You've got to tell it to read during a reload/restart. I usually just restart the process from the web interface after I've checked the config. In the lower left there is a 'Process Info' link, if you click that, on the right there will be a 'restart the nagios process' link you can use. Your new check or changed check would update then. You could probably do this from the init script too.

As for the 'command not found' bit when checking nagios - the binary probably isn't in your path. That init script you ran probably has the executable defined it in somewhere (/usr/bin/nagios is common, you might have it in /usr/local/bin/nagios - look in /etc/init.d/nagios and it'll be listed in there somewhere). Whereever it is, run
/full/path/to/nagios -v /usr/local/nagios/etc/nagios.cfg
and you'll get more info on what nagios is checking that will be a little more helpful than the 'ok' you are getting.

No reason to feel stupid - not asking and having the alerts not work when it mattered would be a reason for embarrassment; asking to be sure you get it right is anything but.

(note - your service check still amusingly says 'calculus' instead of 'Celsius')
omar
Posts: 15
Joined: Fri Jan 24, 2014 12:06 pm

Re: New to Nagios. Installing Custom Plugin Problem

Post by omar »

Finally got it to show something on Nagios Web Interface!!!
Nagios screenshot.png
Turn outs there were two issues. One was that my WeatherGooseII.cfg file was not being read by Nagios. So I had to go into the nagios.cfg file and insert:

Code: Select all

cfg_file /usr/local/nagios/etc/objects/WeatherGooseII.cfg 
Second, when I restarted Nagios, it stated that there was a conflict of sorts relating to define host.

Code: Select all

define host{
        use                          linux-server
        host_name               localhost
        alias                        localhost
        address                   127.0.0.1
        }
Since it was already defined in the localhost.cfg file, it caused a conflict when I copied it into my WeatherGooseII.cfg file. So i deleted the define host part in my WeatherGooseII.cfg file and left define service in. After restarting Nagios, it recognized the command, the script and put the desire input into the Web Interface.

Now, it seems that I should finish my script to include all the other variables I need to check (TempF, Humidity, AirFlow, IO1, etc.). Thanks millisa and all the others who helped.

I'm gonna try to do the method you (millisa) had mentioned before where I can write one script that will obtain the info I need and then define different services in the cfg files to monitor all the different values. Of Course I am gonna try this locally, before we try them remotely. Once again,Thanks.
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: New to Nagios. Installing Custom Plugin Problem

Post by millisa »

Excellent that you got it working. An alternate method of using an explicit include is to include all cfg's in a directory like this:

Code: Select all

cfg_dir=/etc/nagios/conf.d
(So any cfg file you throw in that dir gets read by nagios).

If you are allowed to, share the plugin when you are done, or even post for suggestions discussion along the way - there's a new nagios plugin development forum that appears to be itching for its first actual post discussing plugin development.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: New to Nagios. Installing Custom Plugin Problem

Post by slansing »

I'm gonna try to do the method you (millisa) had mentioned before where I can write one script that will obtain the info I need and then define different services in the cfg files to monitor all the different values. Of Course I am gonna try this locally, before we try them remotely. Once again,Thanks.
Excellent, that is fairly standard practice. Thanks for helping out millisa! We will keep this thread open until all of your issues/brainstorming is complete on this subject Omar.
omar
Posts: 15
Joined: Fri Jan 24, 2014 12:06 pm

Re: New to Nagios. Installing Custom Plugin Problem

Post by omar »

This thread can be closed... Turns out this small project was to get my feet wet into using Nagios... Now my real task is to use the NRPE plugin... I'm very excited to continue using and learning more about Nagios. thanks again to all who has helped
Locked