Search Windows and Linux Networking

Wednesday, October 19, 2011

Adding Windows host in to Nagios Monitoring System

Monitoring windows host from Nagios monitoring system

Last time we have seen how to install nagios. Today we will see how to add Windows system in to nagios for monitoring.

suppose I wanted to monitor following  network in to nagios :-
Suppose :-
Server-PT is mail server and IP address is 192.168.1.2
Router1 has ip address eth0 192.168.1.1 and for eth1 192.168.2.1
Router0 has ip address eth1 192.168.2.2 and for eth0 192.168.3.1
and our other server are in this network like Nagios server, File server, Domain Controller and access point.
Nagios has ip address 192.168.3.2
File_server has ip address 192.168.3.3
AD_server is working as DNS, DHCP and Domain Controller server and it has ip address 192.168.3.4
Access_point has ip address 192.168.3.5

Now login in to Nagios and create object configuration file as:-

# touch /etc/nagios/hosts.cfg   (To define host)
# touch /etc/nagios/services.cfg (To define Services)
# touch /etc/nagios/hostgroups.cfg (To define hostgroups)
# touch /etc/nagios/contacts.cfg (To define Contacts details)





Give sufficient right to nagios to read file 
# chown -r nagios.nagios /etc/nagios/*

Now specify all these file and directory in nagios main configuration file.
# vi /etc/nagios/nagios.cfg
cfg_file=/etc/nagios/hosts.cfg
cfg_file=/etc/nagios/services.cfg
cfg_file=/etc/nagios/hostgroups.cfg
cfg_file=/etc/nagios/contacts.cfg

Now configure object configuration file:-

# vi /etc/nagios/contacts.cfg
 # Define contact details
define contact{
contact_name              sandeep
use                                generic-contact
alias                             Sandeep Kapadane
email                            sandeepk@domainname.com
        }

define contact{
contact_name              help
use                               generic-contact
alias                             IT Support help
email                            help@domainname.com
        }

define contact{
contact_name              manager
use                               generic-contact
alias                             Team Manager
email                            manager@domainname.com
        }

# Define contact groups

define contactgroup{
contactgroup_name     It-Team
alias                             IT Team
members                      sandeepk,help,manager
        }
# vi /etc/nagios/hosts.cfg
# Create template for host as generic-server and core-server

define host{
 name                           generic-server
notifications_enabled              1
event_handler_enabled           1
flap_detection_enabled           1
failure_prediction_enabled      1
process_perf_data                  1
retain_status_information         1
retain_nonstatus_information    1
notification_period                   24x7
register                                    0
        }

define host{
 name                           core-server
use                               generic-server
check_period               24x7
check_interval              5
retry_interval               1
max_check_attempts   10
check_command         check-host-alive
notification_interval      60
notification_options      d,u,r
contact_groups            admins
register                        0
        }

# Define host

define host{
 use                              core-server
host_name                   Router0
alias                             Router0
address                       192.168.3.1
}

define host{
 use                              core-server
host_name                   Router1
alias                             Router1
address                       192.168.1.1
parents                         Router0
}

define host{
 use                              core-server
host_name                   Server-PT
alias                             Mail Server
address                       192.168.1.2
parents                         Router1
}

define host{
 use                              core-server
host_name                   File_server
alias                             File Server
address                       192.168.3.3   
}

define host{
use                               core-server
host_name                   AD_server
alias                             Domain Controller
address                       192.168.3.4
}

define host{
use                               core-server
host_name                   Access_point
alias                             Wireless Access point
address                        192.168.3.5
}

Now define Host Groups in object configuation file

# vi /etc/nagios/hostgroups.cfg
define hostgroup{
hostgroup_name          all_hosts
alias                             All Hosts
members                      Router0, Router1, Server-PT, File_server, AD_server, Access_point
        }

define hostgroup{
hostgroup_name          Domain Controllers
alias                             Domain Controllers
members                      AD_server
}

define hostgroup{
hostgroup_name          CoreNetwork
alias                             CoreNetwork
members                      Router0, Router1,Access_point
}

define hostgroup{
hostgroup_name          CoreServer
alias                             CoreServer
members                      Server-PT, File_server, AD_server
}

Now Define Services to monitor in object configuration file services.cfg
# vi /etc/nagios/services.cfg
  # Create Template for all services.

define service{
name                                         services
active_checks_enabled               1
passive_checks_enabled             1
parallelize_check                        1
obsess_over_service                  1
check_freshness                         0
notifications_enabled                  1
event_handler_enabled               1
flap_detection_enabled               1
failure_prediction_enabled          1
process_perf_data                     1
retain_status_information            1
retain_nonstatus_information       1
is_volatile                                   0
check_period                             24x7
max_check_attempts                 3
normal_check_interval               10
retry_check_interval                  2
contact_groups                          admins
notification_options                   w,u,c,r
# notification_interval                60
notification_period                    24x7
register                                     0
        }
# create template for Ping service

define service{
use                               services
name                            ping
check_command          check_ping!1000.0,20%!2000.0,60%
register                         0
        }
# Add host for ping
define service{
use                               ping
service_description       PING
hostgroup_name           all_hosts
        }
# Monitor UP Time

define service{
use                               services
name                            uptime
check_command          check_nt!UPTIME
register                         0
        }

define service{
use                               uptime
service_description     UP TIME
host_name                   Server-PT, File_server, AD_server
hostgroup_name               
}
define service{
use                               services
name                            Uptime
check_command         check_snmp!-C public -o sysUpTime.
register                                    0
        }

define service{
use                               Uptime
service_description     UP TIME
# host_name                      
           hostgroup_name             CoreNetwork
}


# Monitoring Disk Space 

define service{
        use                               services
        name                            Disk space on c
        check_command          check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        register                        0
        }
define service{
          use                             Disk space on c
          service_description     C: Drive Space
         host_name                  Server-PT, File_server, AD_server
#        hostgroup_name         Domain Controllers
}
define service{
        use                               services
        name                            Disk space on d
        check_command          check_nt!USEDDISKSPACE!-l d -w 80 -c 90
        register                         0
        }
define service{
          use                             Disk space on d
          service_description     D: Drive Space
         host_name                  Server-PT, File_server
#        hostgroup_name         Domain Controllers
}

# Monitoring CPU Load 

define service{
        use                             services
        name                          CPU Load
        check_command        check_nt!CLIENTVERSION
        register                        0
        }
define service{
        use                                    CPU Load
        service_description            CPU Load
        hostgroup_name                Domain Controllers
       host_name                          Server-PT
        }

# Monitoring Memory Usage 
define service{
        use                             services
        name                          Memory Usage
        check_command        check_nt!MEMUSE!-w 80 -c 90
        register                        0
        }
define service{
        use                                     Memory Usage
        service_description             Memory Usage
        hostgroup_name                  Domain Controllers
       host_name                            Server-PT
        }
# Monitoring System Services

define service{
        use                             services
        name                          Server Service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l lanmanServer
        register                        0
        }
define service{
        use                             Server Service
        service_description     Server Service
#       hostgroup_name         Domain Controllers
       host_name                   Server-PT, File_server, AD_server
        }

define service{
        use                             services
        name                          DNS Server Service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l Dns
        register                        0
        }
define service{
        use                                    DNS Server Service
        service_description             DNS Server Service
        hostgroup_name                  Domain Controllers
#       host_name
        }

define service{
        use                             services
        name                          DHCP Server Service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l DhcpServer
        register                       0
        }
define service{
        use                             DHCP Server Service
        service_description     DHCP Server Service
        hostgroup_name         Domain Controllers
#       host_name
       }

define service{
        use                             services
        name                          Net Logon service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l Netlogon
        register                       0
        }
define service{
        use                             Net Logon service
        service_description     Net Logon service
        hostgroup_name         Domain Controllers
#       host_name
        }

# Monitoring NSClient Version 


define service{
        use                               services
        name                            NSClinet Version
        check_command           check_nt!CLIENTVERSION
        register                        0
        }
define service{
        use                                NSClinet Version
        service_description        NSClient++ Version
#      hostgroup_name            Domain Controllers
        host_name                    Server-PT, File_server, AD_server
        }

# Next time we will see how to configure nagios for host and service escalation and dependency

1 comment:

  1. great
    thankx alot
    is there solution of this with nagwin not nagios ?

    ReplyDelete