Page 1 of 3

Nagios Basics

Posted: Thu Jun 12, 2014 10:59 am
by Dave-OD
Hi guys,

This might seem like a basic question, but this is my first time to play around with nagios.

I am looking to create one or two new objects (web proxies), and have a script / monitor running to check web access, including authentication.

From the ground up, how would i go about doing this? Is it all via cli, or can i do some of this through the GUI?

And for testing auth and web access, is there like a generic type script i can use, and maybe tailor somewhat if required?

NagiosĀ® Coreā„¢
Version 3.3.1

Re: Nagios Basics

Posted: Thu Jun 12, 2014 11:05 am
by slansing
Depending on exactly what you are planning to do, you may be able to find a plugin to do this for you:

http://exchange.nagios.org/

You could alternatively build a plugin following:

https://nagios-plugins.org/doc/guidelines.html

Let us know if you have questions!

Re: Nagios Basics

Posted: Thu Jun 12, 2014 12:30 pm
by Dave-OD
Thanks guys..

So if i didnt want to go down the plugin route.

What are my options for acheiving my goal? I already have a large number of devices in Nagios, with a number of scripts. Unfortunately the previous admin has left, so for now i would just like to get these new devices added the quickest way possible.

Thanks,

Dave

Re: Nagios Basics

Posted: Thu Jun 12, 2014 12:36 pm
by tmcdonald
Plugins are absolutely required for Nagios to run any sort of check. Without plugins Nagios cannot do any meaningful work.

Re: Nagios Basics

Posted: Thu Jun 12, 2014 4:38 pm
by Box293
Dave-OD wrote:I already have a large number of devices in Nagios, with a number of scripts. Unfortunately the previous admin has left, so for now i would just like to get these new devices added the quickest way possible.
A plugin is basically just a script.

It sounds like you are taking over a Nagios installaion from a previous tech. So if I am correct you are already monitoring a bunch of devices anyway.

Are these new devices you want to montior the same as your existing devices and you just want to monitor them the same way that is already being done?

Provide a bit more detail and we should be able to help you out.

Re: Nagios Basics

Posted: Fri Jun 13, 2014 11:06 am
by Dave-OD
Hi,

Yes there devices went in and i would like to just do same , however these were added by previous admin.

Any advise, or where i can look for plugins he may have used / installed. Sorry dealing with a total newbie here..

Thanks

Re: Nagios Basics

Posted: Fri Jun 13, 2014 12:27 pm
by sreinhardt
Sorry dealing with a total newbie here..
No worries at all, everyone starts there sometime! I would suggest identifying devices that are currently being monitored and are similar to the ones that you wish to add. Then you will need to look at your nagios configs to see what checks are being run and how. In XI they would be located at /usr/local/nagios/etc/hosts/hostname.cfg or /usr/local/nagios/etc/services/hostname.cfg. Considering you are using core, they could be similar to that, or a totally different naming scheme, but ideally should still be in /usr/local/nagios/etc/ depending on your OS of choice. Once you find some services that look similar to what you might want to check, post them here and we can help you further.

Re: Nagios Basics

Posted: Mon Jun 16, 2014 4:28 am
by Dave-OD
Hi, thanks for the responses guys!!

Sample host which i would like to replicate.

Is it just a matter of creating a duplicate of the following using CP, then modifying its contents?

edirlinux:/usr/local/nagios/etc/objects # more alpwsisc2.cfg

Code: Select all

define host{
        use                     generic-host            ; Name of host template to use
        host_name               alpwsisc2
        alias                   Websense V10000 - alpwsisc2 (10.10.10.10 / 10.10.11.11)
        address                 alpwsisc2
        check_command           check-host-alive
        process_perf_data       1
        max_check_attempts      10
        notification_interval   120
        notification_period     workhours
        notification_options    d,u,r
}

define service{
        use                             generic-service
        host_name                       alpwsisc2
        service_description             http://WWW.GOOGLE.IE
        is_volatile                     0
        check_period                    workhours
        max_check_attempts              5
        process_perf_data               1
        normal_check_interval           1
        retry_check_interval            1
        contact_groups                  admins
        notification_interval           120
        notification_period             workhours
        notification_options            w,u,c,r
        check_command                   check_proxy_google
}

define service{
        use                             generic-service
        host_name                       alpwsisc2
        service_description             http://WWW.IRISHTIMES.COM
        is_volatile                     0
        check_period                    workhours
        max_check_attempts              5
        normal_check_interval           1
        retry_check_interval            1
        process_perf_data               1
        contact_groups                  admins
        notification_interval           120
        notification_period             workhours
        notification_options            w,u,c,r
        check_command                   check_proxy_irishtimes
}

define service{
        use                             generic-service
        host_name                       alpwsisc2
        service_description             WEBSENSE POLICY SERVER: BLOCK WEBEMAIL
        is_volatile                     0
        check_period                    workhours
        max_check_attempts              3
        normal_check_interval           1
        contact_groups                  admins
        process_perf_data               1
        notification_interval           30
        notification_period             workhours
        notification_options            w,u,c,r
        check_command                   check_proxy_webemail
}

define service{
        use                             generic-service
        host_name                       alpwsisc2
        service_description             WEBSENSE POLICY SERVER: ALLOW EDUCATION
        is_volatile                     0
        check_period                    workhours
        max_check_attempts              3
        normal_check_interval           1
        process_perf_data               1
        retry_check_interval            1
        contact_groups                  admins
        notification_interval           30
        notification_period             workhours
        notification_options            w,u,c,r
        check_command                   check_proxy_education

Re: Nagios Basics

Posted: Mon Jun 16, 2014 1:41 pm
by slansing
As far as this host goes yes, you can copy the .cfg file and change it's host name and address for starters, then verify your configurations with:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Then restart nagios to effect the changes:

Code: Select all

service nagios restart
And then check the web interface to see the new host. The above commands assume you have followed:

http://assets.nagios.com/downloads/nagi ... Source.pdf

On a centos/rhel server.

Re: Nagios Basics

Posted: Wed Jun 18, 2014 7:09 am
by Dave-OD
Cheers guys... seems to have worked for the most part.

Copied original file, and used VI to edit the file contents. The object seems to be responding to PING ok, see below. But failing all checks. I also dont see any attempts to monitor hitting my firewall logs, which i do see for the original device i copied.

Is there some other settings, IP addresses etc i need to ammend also??

Host State Information
Host Status: UP (for 0d 0h 2m 42s)
Status Information: PING OK - Packet loss = 0%, RTA = 1.19 ms
Performance Data: rta=1.194000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0
Current Attempt: 1/10 (SOFT state)
Last Check Time: 06-18-2014 13:02:45
Check Type: ACTIVE
Check Latency / Duration: 0.213 / 4.032 seconds
Next Scheduled Active Check: 06-18-2014 13:07:55
Last State Change: 06-18-2014 13:02:55
Last Notification: N/A (notification 0)
Is This Host Flapping? NO (11.71% state change)
In Scheduled Downtime? NO
Last Update: 06-18-2014 13:05:35 ( 0d 0h 0m 2s ago)


This is my new host. Basically just edited out anywhere which mentioned previous object and put in new object / hostname.

edirlinux:/usr/local/nagios/etc/objects # more webproxy2.cfg
define host{
use generic-host ; Name of host template to use
host_name webproxy2
alias Proxy - webproxy2 (10.10.10.12 / 10.10.10.13)
address webproxy2
check_command check-host-alive
process_perf_data 1
max_check_attempts 10
notification_interval 120
notification_period workhours
notification_options d,u,r
}

define service{
use generic-service
host_name webproxy2
service_description http://WWW.GOOGLE.IE
is_volatile 0
check_period workhours
max_check_attempts 5
process_perf_data 1
normal_check_interval 1
retry_check_interval 1
contact_groups admins
notification_interval 120
notification_period workhours
notification_options w,u,c,r
check_command check_proxy_google
}

define service{
use generic-service
host_name webproxy2
service_description http://WWW.IRISHTIMES.COM
is_volatile 0
check_period workhours
max_check_attempts 5
normal_check_interval 1
retry_check_interval 1
process_perf_data 1
contact_groups admins
notification_interval 120
notification_period workhours
notification_options w,u,c,r
check_command check_proxy_irishtimes
}

define service{
use generic-service
host_name webproxy2
service_description WEBSENSE POLICY SERVER: BLOCK WEBEMAIL
is_volatile 0
check_period workhours
max_check_attempts 3
normal_check_interval 1
contact_groups admins
process_perf_data 1
notification_interval 30
notification_period workhours
notification_options w,u,c,r
check_command check_proxy_webemail
}

define service{
use generic-service
host_name webproxy2
service_description WEBSENSE POLICY SERVER: ALLOW EDUCATION
is_volatile 0
check_period workhours
max_check_attempts 3
normal_check_interval 1
process_perf_data 1
retry_check_interval 1
contact_groups admins
notification_interval 30
notification_period workhours
notification_options w,u,c,r
check_command check_proxy_education
}

edirlinux:/usr/local/nagios/etc/objects #

Host Service Status Last Check Duration Attempt Status Information

webproxy2


WEBSENSE POLICY SERVER: ALLOW EDUCATION


CRITICAL 06-18-2014 13:15:39 0d 1h 10m 52s 3/3 CRITICAL - Socket timeout after 10 seconds
WEBSENSE POLICY SERVER: BLOCK WEBEMAIL


CRITICAL 06-18-2014 13:15:39 0d 1h 11m 32s 3/3 CRITICAL - Socket timeout after 10 seconds
WWW.GOOGLE.IE


CRITICAL 06-18-2014 13:15:39 0d 1h 11m 11s 5/5 CRITICAL - Socket timeout after 10 seconds
WWW.IRISHTIMES.COM


CRITICAL 06-18-2014 13:15:39 0d 1h 10m 51s 5/5 CRITICAL - Socket timeout after 10 seconds