Thursday, February 19, 2009

Network Monitoring using Nagios on Debian

Step 1: Installation of Nagios


nagios:/etc/nagios#apt-get install nagios-text

Step 2: Configuration

EDIT /etc/nagios/contacts.cfg AND ADD FOLLOWING

define contact{
contact_name imran
alias imran
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email imran@fizaan.com
}
EDIT /etc/nagios/contactgroups.cfg AND ADD FOLLOWING
define contactgroup{
contactgroup_name server-admin
alias Systems Administrators
members imran
}

EDIT /etc/nagios/hosts.cfg AND ADD YOUR HOSTS WHICH YOU WANT TO MONITOR
define host{
use generic-host
host_name www.fizaan.com
alias website
address 192.168.0.10
check_command check-host-alive
max_check_attempts 20
notification_interval 240
notification_period 24x7
notification_options d,u,r
}
define host{
use generic-host
host_name mail.fizaan.com
alias mail
address 192.168.0.20
check_command check-host-alive
max_check_attempts 20
notification_interval 240
notification_period 24x7
notification_options d,u,r
}
EDIT /etc/nagios/hostgroups.cfg AND ADD FOLLOWING

define hostgroup{
hostgroup_name Linux Servers
alias Servers
contact_groups server-admin
members www.fizaan.com,mail.fizaan.com
}

EDIT /etc/nagios/services AND ADD YOUR SERVICES, e.g
You cand define more than 1 service for each host.

# Service definition
define service{
use generic-service ; Name of service template to use

host_name mail.FIZAAN.com
service_description Total Processes
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 2
contact_groups server-admin
notification_interval 240
notification_period 24x7
notification_options w,u,c,r
check_command check_procs!150!200!RSZDT
}
# Service definition
define service{
use generic-service ; Name of service template to use

host_name www.fizaan.com
service_description HTTP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups server-admin
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_http
}

Step 3: Check the syntex error, if every thing ok, it will show following.

nagios:/etc/nagios# nagios -v /etc/nagios/nagios.cfg
.
.
Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

Step 4: Restart the Nagios



nagios:/etc/nagios#/etc/init.d/nagios restart

Step 5: Open the Site and login

http://192.168.0.5/nagios/
or
http://nagios.fizaan.com/nagios/

username: nagiosadmin
password: provided during installation


Pluging Directory

Following are default plugins installed with Nagios.
nagios:/usr/lib/nagios# cd plugins/
nagios:/usr/lib/nagios/plugins# ls
check_apt check_file_age check_imap check_mrtgtraf check_oracle check_simap check_ups
check_breeze check_flexlm check-imap check_mysql check_overcr check_smtp check_users
check_by_ssh check_fping check_ircd check_mysql_query check_pgsql check_snmp check_wave
check_clamd check_ftp check_jabber check_nagios check_ping check_spop eventhandlers
check_dhcp check_game check_ldap check_nagios_db check_pop check_ssh negate
check_dig check_hpjd check_ldaps check_nntp check_procs check_ssmtp urlize
check_disk check_http check_load check_nntps check_radius check_swap utils.pm
check_disk_smb check_icmp check_log check_nt check_real check_tcp utils.sh
check_dns check_ifoperstatus check_mailq check_ntp check_rpc check_time
check_dummy check_ifstatus check_mrtg check_nwstat check_sensors check_udp
nagios:/usr/lib/nagios/plugins#


Note: Comment out the /etc/nagios/esclations.cfg file

No comments: