Thursday, January 15, 2009

Nagios in control.


Nagios.


Nagios is a popular open source computer system and network monitoring application software. It watches hosts and services, alerting users when things go wrong and again when they get better.

Adding a new server.

Nagios Administration


This will help you in adding a new server to Nagios


1. Introduction

2. Adding Contacts

3. Adding Hosts

4. Adding Host Groups

5. Adding Services

6. Scheduling Host/Service Downtime

7. Acknowledging a host/services

8. Authentication Setup


In NAGIOS SERVER




contacts.cfg

Defines who gets notifications about problems with hosts and services.


define contact{
contact_name sylesh
alias syslogs
service_notification_period none ; Notification period
host_notification_period 24x7 ; Notification period
service_notification_options c,r ; Notification Options
host_notification_options d,r ; Notification Options
service_notification_commands notify-by-email ; Notification cmd
service_notification_options n ; Notification cmd
host_notification_commands host-notify-by-email
email syleshh@gmail.com
}





contactgroups.cfg


Add the user to the appropriate department/server group he/she needs to be a member of


define contactgroup{
contactgroup_name testgroup ; Group Name
alias mycutelife ; Alias for group
members testuser ; List of members. This user has the privilege to view the status of the
servers which is listed in the group
}





hostgroups.cfg


This allows you to create groups to organise the hosts

define hostgroup{
hostgroup_name testhostgroup
alias syslogs
contact_groups testgroup
members server1.hostname.com,server2.hostname.com,server3.hostname.com,server4.hostname.com
}





hosts.cfg

This contains all the devices you want nagios to check

#############First Server#############
define host{
use generic-host ; Name of host template to use
host_name server1.hostname.com
alias server1
address 192.168.1.1
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,u,r
}
#############Second Server#############
define host{
use generic-host ; Name of host template to use
host_name server2.hostname.com
alias server2
address 192.168.1.2
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,u,r
}





services.cfg

If we give host_name (host_name test.test.com) in place of hostgroup_name, we have to add each service entries to be monitored for each server. But if we give hostgroup_name and all hosts or servers are defined in the file hostgroups.cfg, we need only one entry for each service for all servers.

#########We can define the services to monitor#############
#########Apache#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description Apache status
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_http
}
#########MTA#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description MTA status
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_smtp
}
#########QMAIL Queue#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description QMAIL-Q
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_qmailq
}
#########Exim Queue#########
define service{

use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description EXIM_QUEUE
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_eximmailqueue
}


#########FTP#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description FTP status
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
contact_groups testgroup
retry_check_interval 1
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_ftp
}
#########Server Load#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description SYS-LOAD
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_load
}
#########MYSQL#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description MYSQL
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_mysqlrc
}
#########DNS#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description DNS
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_dns
}
#########SSH#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description SSH
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_ssh
}


#########POP#########
# Service definition
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description POP3
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_pop
}
#########DISK_USAGE_SLASH#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description DISK_USAGE_SLASH
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_diskslash
}
#########DISK_USAGE_BOOT#########
define service{
use generic-service ; Name of service template to use
hostgroup_name testhostgroup
service_description DISK_USAGE_BOOT
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_diskboot
}
#########DISK_USAGE_BACKUP#########
define service{
hostgroup_name testhostgroup
service_description DISK_USAGE_BACKUP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_diskbackup
}
#########DISK_USAGE_HOME#########
define service{
hostgroup_name testhostgroup
service_description DISK_USAGE_HOME
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_diskhome
}
#########DISK_USAGE_TMP#########
define service{
hostgroup_name testhostgroup
service_description DISK_USAGE_TMP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_disktmp
}
#########DISK_USAGE_USR#########
define service{
hostgroup_name testhostgroup
service_description DISK_USAGE_USR
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_diskusr
}
#########DISK_USAGE_VAR#########
define service{
hostgroup_name testhostgroup
service_description DISK_USAGE_VAR
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups testgroup
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_diskvar
}



--------------------------------------------------------------------------
Sylesh

No comments: