here is a sample to monitor the specific http url address in nagios conf file.
you can use the direct cmd to test if it works under shell
[root@cent libexec]# ./check_http -u /accounts/login/ -H 121.xx.10.xx
HTTP OK: HTTP/1.1 200 OK - 9555 bytes in 0.055 second response time |time=0.054723s;;;0.000000 size=9555B;;;0
that means that your cmd works well and detect the http service and feedback 200 ok.
edit the cfg file to add a config section
service_description web http service for seafile portal login page
check_command check_http! -H 12x.xx.160.xx -u /accounts/login/
There are lots of services monitor in your nagios,what if the service is down?
The most important issue is that the admin should be notified by the first time,email is great tool on it.
edit the contact.cfg file to tell the nagios who is the admin to receieve all the mail
# template which is defined elsewhere.
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (de
alias Nagios Admin ; Full name of user
email firstname.lastname@example.org ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
nothing need to be changed in the commands.cfg,the sample is marked below:
# 'notify-host-by-email' command definition
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME
$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTI
FICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
# 'notify-service-by-email' command definition
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SER
VICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Inf
o:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$
3.using the sendmail in linux to sending mail
vi the /etc/mail.rc which is the config file of sendmail
# add by admin
set email@example.com smtp=smtp.gmail.com
set firstname.lastname@example.org smtp-auth-password=pwd_email_account smtp-auth=login
enable the function of mail notification by add option “notifications_enabled 1”
# Change the host_name to match the name of the host you defined above
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
//add notifications_enabled in services will open the notification
bring down one of the service,you will get the email notification
you can use nagios to monitor your infrastructure of basic IT resources.
you should first define a host to be monitored then use the define service to do the action,it’s the OO thinking mind.
taking the NT platform as a example,install the NSClient++ plugin as agent to the hosts you want to monitor.
use windows-server ; Inherit default values from a template
host_name host1 ; The name we're giving to this host
alias COS Security Server ; A longer name associated with the host
address 172.16.60.134 ; IP address of the host
service_description NSClient++ Version
check_command is the bin action of monitoring the resource,there are lots of monitor action in $nagios/bin and you add