Monitoring Server menggunakan OZEKi NG
Misal:
PC server windows yang akan di monitoring mengirimkan sinyal ERROR->Lalu di proses oleh Nagios->Ozeki -> sms->operator!
Install NSClient++ pada server / PC yang hendak dimonitoring
Misal IPnya=192.168.91.144
IP server/PC yang hendak dimonitoring
NAGIOS SERVER misalkan: "192.168.91.124"
Nagios Server dengan IP address-nya
Selanjutnya pakai bahasa inggris ajah ya...:-)
Lalau Open
"nagios.cfg" file to edit. Start "Terminal" and login as administrator then open "nagios.cfg" file with "vi" editor. To do so type in the follows (Figure 5):
vi /usr/local/nagios/etc/nagios.cfg
|
Edit Nagios' configuration file
Find the following row: /Hilangkan tanda comment-nya
# Definitions for monitoring Windows machine
Press "i" to enter Insert mode and in the row below it, delete the comment mark. The final row will look like as follows (Figure 6):
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
Then press "Escape" and type the follows to exit and save the file:
# Definitions for monitoring Windows machine
Press "i" to enter Insert mode and in the row below it, delete the comment mark. The final row will look like as follows (Figure 6):
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
Then press "Escape" and type the follows to exit and save the file:
:wq
|
Remove comment from configuration file
Now open "windows.cfg" file with "vi" editor. You can do this if you type in the following command :
vi /usr/local/nagios/etc/objects/windows.cfg
|
Edit windows configuration file
Press "i" to enter Insert mode, then find the row beginning with "address". Now type the IP address of the computer you wish to monitor. In our example the row will look like as follows (Figure 8):
address 192.168.91.144
address 192.168.91.144
Insert monitored computer's IP address
Then press "Escape" and type the follows to exit and save the file:
:wq
|
I have already downloaded "sms_send.sh" shell script to the desktop.
download di:
http://www.sms-integration.com/attachments/110/sms_send.sh
isinya sbb:
#!/bin/bash
url1="http://127.0.0.1:9501/api?action=sendmessage&username=admin&password=abc123&recipient=085279959498&messagetype=SMS:TEXT&messagedata="
url2="$@"
url2+=$(php -r "echo rawurlencode('$(sed "s/'/\\\\'/g" <<< )');")
url=$url1+$url2
wget -O- "$url"
Now I copy it to "libexec" directory of Nagios :
cp /home/ozekisms/Desktop/sms_send.sh /usr/local/nagios/libexec/
|
Copy the shell script
You can customize the "send_sms.sh" if you change "url1". In our example it is customized in the following way:
#!/bin/bash
url1="http://127.0.0.1:9501/api?action=sendmessage&username=admin&password= abc123&recipient=085279959498&messagetype=SMS:TEXT&messagedata=" url2="$@" url2+=$(php -r "echo rawurlencode('$(sed "s/'/\\\\'/g" <<< )');") url=$url1+$url2 wget -O- "$url" |
You can customize url1 variable in the following way:
http://127.0.0.1:9501 is the computer on which Ozeki NG SMS Gateway has been installed
username=admin is the username you use to log into Ozeki NG SMS Gateway
password=abc123 is the password of the user
recipient=085279959498 recipient's phone number
http://127.0.0.1:9501 is the computer on which Ozeki NG SMS Gateway has been installed
username=admin is the username you use to log into Ozeki NG SMS Gateway
password=abc123 is the password of the user
recipient=085279959498 recipient's phone number
Now open "commands.cfg" file with "vi" editor:
vi /usr/local/nagios/etc/objects/commands.cfg
|
Edit commands configuration file
Press "i" to enter Insert mode and insert a new row after "notify-service-by-email" and "notify-host-by-email" and provide the following commands
# 'notify-service-by-sms' command definition
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: $LONGDATETIME$" } # 'notify-host-by-sms' command definition 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: $LONGDATETIME$" } |
Then press "Escape" and type the follows to exit and save the file:
:wq
|
Notification commands
Open "contacts.cfg" file with "vi" editor :
vi /usr/local/nagios/etc/objects/contacts.cfg
|
Edit contacts file
Press "i" to enter Insert mode and insert a new row before the one beginning with "e-mail". Type the follows :
service_notification_commands notify-service-by-sms host_notification_commands notify-host-by-sms
|
Notification commands for admin
Then press "Escape" and type the follows to exit and save the file:
:wq
|
Then restart Nagios service to have changes come into operation. Type in the following command:
service nagios restart
|
Restart Nagios service
After Nagios has been restarted, start your web browser and type in the follows:
http://localhost/nagios
|
Critical error in Nagios
If you take a look at Ozeki NG SMS Gateway you can see that the message has been sent out .
Lihat Video
uhfs....selesai deh
referensi:
http://www.sms-integration.com/how-to-send-alert-sms-from-nagios-110.html

Tidak ada komentar:
Posting Komentar