Yes you can Monitor Websites and Web Services Live for Free from PC Using Nagios. Nagios is a host and service monitoring tool designed to inform network problems. When problems are encountered, the Nagios daemon can send notifications out to you in a variety of different ways (email, instant message, etc.). Current status information, historical logs, and reports can all be accessed via a web browser too.
Features of Nagios include Monitoring of network services like SMTP, POP3, HTTP, IMAP, PING, FTP, etc. This features also can be used to monitor your websites which are hosted in third party hosting servers, that’s especially from home/office PC itself!!
Setting up Nagios for your domains:
1) Installation process
You can use following commands to install components needed.
- Installing Apache/httpd and Nagios under Fedroa Core/Cent OS Linux
# yum install httpd
# chkconfig httpd on
# /etc/init.d/httpd start
# yum install nagios nagios-plugins nagios-plugins-all
- Debian, Ubuntu Linux httpd/Apache and Nagios installation
# apt-get install apache2
# /etc/init.d/apache2 start
# apt-get install nagios-text nagios-plugins nagios-images
or
# apt-get install nagios2 nagios-plugins nagios-images
- If you don’t have yum/apt. Install stable apache/nagios by downloading from following sites
Apache:- http://httpd.apache.org/
Nagios:- http://www.nagios.org/download/#stable
Now we done with Installation next….
[ad#add-top-in]
2) Configuring Nagios:
- Add a custom directory for your *.cfg files
# mkdir /etc/nagios2/mysite
- Edit /etc/nagios2/nagios.cfg and edit the following path
Default path cfg_dir=/etc/nagios2/conf.d to
cfg_dir=/etc/nagios2/mysite
- Create your own configuration files inside the defined directory that is In /etc/nagios2/mysite; add the following files.
– contacts.cfg: Defines the people who will receive the alerts in case of a problem.
Here you need to change e-mail ID and Pager ID.
define contact{
contact_name Admin
alias Administrator Name
service_notification_period 24×7
host_notification_period 24×7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email,notify-by-pager
host_notification_commands host-notify-by-email,host-notify-by-epager
email admin@yourdomain.com
pager 11111111@pager.yourdomain.com
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members Admin # contact_name should be added here
}
– host.cfg: Defines the url’s that will be monitored.
##You can add as many as url’s need like bellow
define host{
host_name jithesh.com
alias Jithesh
address www.jithesh.com
use generic-host
}
define host{
host_name blog.jithonline.com
alias JithOnline
address blog.jithonline.com
use generic-host
}
#### Hostgroup_name ###
define hostgroup {
hostgroup_name all
alias All Servers
members *
}
# A list of your servers
define hostgroup {
hostgroup_name servers
alias Servers
members jithesh.com, blog.jithonline.com #Add all host_name here
}
– services.cfg: Defines the services that will be monitored for each URL.
## Hostgroups services ##
define service {
hostgroup_name servers
service_description HTTP
check_command check_http
use generic-service
notification_interval 0
}
define service {
hostgroup_name servers
service_description PING
check_command check_ping!100.0,20%!500.0,60%
use generic-service
notification_interval 0
}
define service {
hostgroup_name servers
service_description FTP
check_command check_ftp
use generic-service
notification_interval 0
}
define service {
hostgroup_name servers
service_description POP
check_command check_pop
use generic-service
notification_interval 0
}
define service {
hostgroup_name servers
service_description IMAP
check_command check_imap
use generic-service
notification_interval 0
}
define service {
hostgroup_name servers
service_description SMTP
check_command check_smtp
use generic-service
notification_interval 0
}
– templates.cfg: Defines some templates like the generic url, generic service and a lot of others custom templates.
In the default installation you will find files named generic-host_nagios2.cfg, generic-service_nagios2.cfg and there might be others. Just with copy and paste them into /etc/nagios2/mysite directory it will work OK. Anyway, I prefer to put the definitions on each of them into a single file called templates.cfg, but that’s a personal preference.
– timeperiods.cfg: Defines time periods which are valid for checks, notifications, etc.
The default configuration file is OK, so just copy and paste it from /etc/nagios2/conf.d/timeperiods_nagios2.cfg to /etc/nagios2/mysite/timeperiods.cfg.
So we have done with all configuration stuffs.
3) Restart the Nagios service:
# /etc/init.d/nagios2 restart
If there is any configuration error Nagios will tell you where it is when you attempt to restart the service.
4) Monitor your URLs
By opening Nagios in browser
http://<nagios_server_host>/nagios2
user name:-nagiosadmin
passwd:-<set passwd> Most of the case root passwd itself
If you still having problems, don’t hesitate to post comment.
hi dude,
This is anish from chennai , i configured all the things for nagios but i dont know how to monitor url using nagios…now i can abel to monitor server load only..pls guide me..