Page 2 of 2

Re: New to Nagios. Installing Custom Plugin Problem

Posted: Tue Jan 28, 2014 2:51 pm
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.

Re: New to Nagios. Installing Custom Plugin Problem

Posted: Tue Jan 28, 2014 3:41 pm
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')

Re: New to Nagios. Installing Custom Plugin Problem

Posted: Wed Jan 29, 2014 3:09 pm
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.

Re: New to Nagios. Installing Custom Plugin Problem

Posted: Wed Jan 29, 2014 4:27 pm
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.

Re: New to Nagios. Installing Custom Plugin Problem

Posted: Wed Feb 05, 2014 10:09 am
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.

Re: New to Nagios. Installing Custom Plugin Problem

Posted: Fri Feb 07, 2014 9:50 am
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