Subscribe:

Ads 468x60px

Pages

Wednesday, August 24, 2011


Login as root
# su -
# <Enter password>

open nagios configuration file
# vi /usr/local/nagios/etc/nagios.cfg

open your windows configuration file for editing
# vi /usr/local/nagios/etc/ojects/windows.cfg

###Enter insert mode and provide the monitored computer's IP address here###
###Host Definations###
define host {
use windows-server
host_name winserver
alias My Windows Server
address 192.168.91.2
}

Now exit and save this file
:wq

I have already downloaded "send_sms.sh" script into my desktop

I will copy "sms_send" script to the "libexec" folder
# cp /root/Desktop/sms_send.sh /usr/local/nagios/libexec

open your "commands config file for editing
# vi /usr/local/nagios/etc/objects/commands.cfg

Enter insert mode and type your command definations here
## ozeki's NG's 'notify-service-by-sms' command defination ##
define command{
command_name   notify-service-by-sms
command_line   /usr/local/nagios/libexec/sms_send.sh "--Nagios Service Notification --Host: $HOSTNAME$, State: $HOSTSTATE$, Service:$SERVICEDESC$, Description: $SERVICESTATE$, TIME:$LONGDATETIMES$"
}


## ozeki's NG's 'notify-host-by-sms' command defination ##
define command{
command_name   notify-host-by-sms
command_line   /usr/local/nagios/libexec/sms_send.sh "--Nagios Host Notification --Host: $HOSTNAME$, State: $HOSTSTATE$, TIME:$LONGDATETIMES$"
}

once it is done,exit and save your file
:wq

Open your "contacts" config file for editing
# vi /usr/local/nagios/etc/objects/contacts.cfg
## below the CONTACTS section edit the following ##
##Enter the notification command values for the contact##
define contact{
contact_name nagiosadmin;
use generic-contact;
alias Nagios Admin;
service_notification_commands   notify-service-by-sms
host_notification_commands   notify-host-by-sms
email nagios@localhost;
}


Onece it is done, exit and save your file.
:wq


To make changes come into force, restart Nagios service
# service nagios restart

Now you can start Nagios
# firefox http://localhost/nagios

Enter user name and password

click Host Group
click services
click criticals
As you can see there are already some problems with the monitored computer.

If you take a look at Ozeki NG - SMS Gateway you can see the sent message.
# firefox http://127.0.0.1:9501

Enter user name and password of SMS Gateway application

click admin
click sent
view the message have been sent.

For more information please visit Ozekisms site

0 comments:

Post a Comment