Hello,
This is my basic idea about controlled, manageable and isolated nagios interface for different client using a nagios server.
Infra structures.
1. 2 windows servers ( nagios host)
a. install nsclient application from http://sourceforge.net/projects/nscplus and enable nrpe/nsclient except wmichecks. “allowed_hosts=
b, If you are enabled windows firewall, pls open the port 5666 and 12489
c, Also make sure that ICMP echo request should be listen the nagios host and can be enable it using advanced LAN properties on windows firewall.
2. Linux Virtual nagios server ( Centos 5.3) on different geographical location
3, patience
First install nagios, nagios plug ins on a Linux virtual server. I suppose to believe that you have hand experience with nagios basic installation and aware about linux.
1. First I want to create custom template for host,services, hostgroup and contact .
here we go,
I suppose nagios installed on “/usr/local/nagios/”
Nagios installation directory will have
[root@dev nagios]# ls
bin etc libexec sbin share var
[root@dev nagios]#
[root@dev nagios]# cd etc/objects/
[root@dev objects]# ls
commands.cfg ggs-windows.cfg templates.cfg
contacts.cfg hostservice-groups.cfg printer.cfg timeperiods.cfg
linux-box.cfg shared-hosting.cfg windows.cfg
ggs2-windows.cfg localhost.cfg switch.cfg
Now I am going to create a separate template for my windows farm. Change directory to etc/object on nagios installation. Creating a new file.
vi ggs-windows-tmpl.cfg
define host{
name ggs-servers
use generic-host
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 5
notification_options d,r
contact_groups ggsgroup
hostgroups windows-servers
register 0
}
save and exit
Then edit vi /usr/local/nagios/etc/nagios.cfg and add the following line at the end of sample windows cfg list then add the new entry
# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
cfg_file=/usr/local/nagios/etc/objects/ggs-windows.cfg
Now we need to verify the syntax of this file was ok or not ?
Use this commands
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
2. Next step is we need to add contact list and create servers groups for visual identification
vi ggs-windows.cfg then added the below lines.
# GGS contacts ###
define contact{
contact_name tom
use ggs-contact
alias Tom Thomas
email tom@yahoo.co.uk
}
define contact{
contact_name liju
use generic-contact
alias Liju Mathew
email liju@nagiostrail.com
}
define contactgroup{
contactgroup_name ggs-admins
alias GGS Administrators
members tom,liju
}
### grouping servers
define hostgroup{
hostgroup_name GGS-servers
alias Client Servers
members GGS1-server,GG2-server
}
Again save and re-run the nagios syntax checking tool.
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Step :4
Now we are going to define generic-service settings for my ggs-servers
I have modified the default service settings.So again I am editing the same file.
vi ggs-windows.cfg then added the below lines.
define service{
name generic-ggs-service
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 5
retry_check_interval 2
contact_groups ggs-admins
notification_options w,u,c,r
notification_interval 30
notification_period 24x7
register 0
}
Now we need to verify the syntax of this file was ok or not ?
Use this commands
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Now we have defined templates/create a stricture for what or how a nagios check and alert ours above servers.
Here we are going to inform nagios system which type of services/ports/programs to be it checked.
Initially create separate file for each host to be monitored.
vi /usr/local/nagios/etc/objects/ggs-winsvr1.cfg
define host{
use ggs-servers
host_name GGS-server
alias GGS-server
address 100.109.100.101
}
define service{
use generic-ggs-service
host_name GGS-svr1
service_description Uptime
check_command check_nt!UPTIME
}
define service{
use generic-ggs-service
host_name GGS-svr1
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
define service{
use generic-ggs-service
host_name GGS-svr1
service_description C:\ Drive Usage
contact_groups ggsgroup
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
define service{
use generic-ggs-service
host_name GGS-svr1
service_description D Drive Usage
contact_groups ggsgroup
check_command check_nt!USEDDISKSPACE!-l d -w 80 -c 90
}
define service{
use generic-ggs-service
host_name GGS-svr1
service_description MySQL-server
contact_groups ggsgroup
check_command check_nt!PROCSTATE!-d SHOWALL -l mysqld.exe
}
define service{
use generic-ggs-service
host_name GGS-svr1
service_description ggs website
check_command check_http!-u http://mywebsite.com -t 5 -s “search-string”
}
define service{
use generic-ggs-service
host_name GGS-svr1
service_description W3SVC
contact_groups ggsgroup
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
Then save and add this file entry on ” /usr/local/nagios/etc/nagios.cfg” file like
cfg_file=/usr/local/nagios/etc/objects/ggs-winsvr1.cfg
Then run the syntax checking utility
Use this commands
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Now the host one is ready to monitor.
Restart the nagios server
# service nagios restart
Pls add this server name on ” hostgroup list in main template file here it’s ” GGS-svr1″
How to provide nagios web interface access to the client which will have our other server access/monitoring details ?
Ans: create a exact same nagios “contact name ” as a user in Apache password file which was created during the nagios installation time.
#htpasswd /usr/local/nagios/etc/htpasswd.users liju
In the above example I assume that server has installed IIS and MySQL. This nagios command “check_nt!PROCSTATE!-d SHOWALL -l mysqld.exe” will check the presence of mysqld.exe in windows process list on evey 5 minutes interval.
-enjoy