Ping Test set up for Nagios

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
mkhan01
Posts: 7
Joined: Mon Jun 01, 2015 1:55 pm

Ping Test set up for Nagios

Post by mkhan01 »

I was hoping I could get help with setting up ping test with Nagios Core for monitoring projectors that are connected to the network. The projectors have static I.P.s and my nagios is installed on a OVM on a linux server. The version of linux running on my OVM is Oracle Linux 7, and Nagios Core is up to date. I'm not necessarily quite sure on which plugins to install to set up the ping test. The end game would be to have ping test set up so I can know when a projector is disconnected from network and I would receive an email notification for it.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Ping Test set up for Nagios

Post by jolson »

Great - I recommend that you look into our Object Configuration Overview guide. After understanding the different pieces that make Nagios work, you will need to create a host definition.

You can check to see if you have the check_ping or check_icmp plugin available to you:

Code: Select all

ls -l /usr/local/nagios/libexec
Good things to note:
If you don't have any Nagios Plugins, you can install them in the following way:

Code: Select all

cd /tmp
wget https://github.com/nagios-plugins/nagios-plugins/archive/master.tar.gz -O nagiosplugins.tar.gz
tar xzf nagiosplugins.tar.gz
cd nagios-plugins-master/
./tools/setup
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
You will need 1 host definition per projector.

An example host definition might look something like this:

Code: Select all

define host {
        host_name                       projector-1.something.local
        use                             generic-service   ; this is a template
        address                         192.168.x.x      ; IP Address of the projector
        check_command                check_ping!200.0,20%!600.0,60%
        check_period                    24x7
        notification_interval           60
        notification_period             24x7
        register                        1
        }
I am sure you'll have questions - let us know how we can help you along the way. Thanks!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
mkhan01
Posts: 7
Joined: Mon Jun 01, 2015 1:55 pm

Re: Ping Test set up for Nagios

Post by mkhan01 »

I checked to see if I had either the check_ping or check_icmp plugin, and I have check_ping. Based on what was said, I assume having either would be fine and no need to install another plug in.

I need help with defining a host, I'm stuck on the point where I would define a projector as a host.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Ping Test set up for Nagios

Post by jolson »

No problem.

When you're defining a host, it'll be under a simple text file. You can store this file where you'd like, but I recommend sticking it under /usr/local/nagios/etc/ somewhere. By default, you should have a few listed in /usr/local/nagios/etc/objects - I'll use that directory for the sake of example.

Create the host file:

Code: Select all

vi /usr/local/nagios/etc/exampleprojector.cfg
Add the following information to the file:

Code: Select all

define host{
        use             linux-server                  ; Inherit default values from a template
        host_name       proj1firstfloor          ; The name we're giving to this projector
        alias             ProjectorM400            ; A longer name associated with the projector
        address         192.168.1.30             ; IP address of the projector
        }
Read up on templates to understand what the 'use' field is used for - https://beginlinux.com/server/nagios/ob ... nce-nagios

By default, the above definition will include a ping check. The linux-server template automatically applies this check to your host.

After the configuration is done, we need to make nagios aware of this new host. We can do that in the following file.

Code: Select all

vi /usr/local/nagios/etc/nagios.cfg
You have two settings that you can use:

Code: Select all

cfg_file=
-or-

Code: Select all

cfg_dir=
After you have defined your host, run a quick check to make sure everything looks fine:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If all is good, restart nagios and the changes will be reflected in the Web GUI.

Code: Select all

service nagios restart
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked