Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Linux Applications Tập hợp các bài viếc hướng dẫn cài đặt các ứng dụng phổ biến trên Linux (CentOS)

Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 10-10-2017, 11:31 PM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Hướng dẫn cấu hình gửi SMS bằng Nagios
Hướng dẫn cấu hình gửi SMS bằng Nagios

Send Nagios Alert Notification Using SMS




Introduction

One of the most important feature of the monitoring platform is the notification system; by default they use the local mail daemon (postfix, mail, exim) installed on the server to send the notifications.
Using local mail daemon has many issues :
  • You need to install and configure your smtp server.
  • Maybe your mail server go down so you can’t receive the alert.
  • Maybe this kind of emails from a not verified source like nagios can be filtered by the same company antispam system.
In order to avoid all issues, In this article I am going to explain how to send alert from monitoring tool Nagios Core using SMS.


This task was not so easy since communicating with the smsgateway through a linux server was requiring to install smstools.
If you still didn’t install Nagios Core , check the following articles.
Install SmsTools

The SMS Server Tools are made to send and receive short messages through GSM modems. It supports easy file interfaces and it can run external programs for automatic actions.

To be able to send SMS in a team with Linux will need the following:
  • A modem GSM GPRS.
  • A card SIM mobile with data activated to be able to send SMS. It is convenient to review that the sending of SMS works properly inserting the card SIM in a mobile and sending a SMS .
  • Coverage of the mobile network in the zone where place the modem GSM: obviously it has to have coverage of the mobile network so that it work the sending of SMS from the modem GSM.
Then you insert the card SIM in the modem GSM and will connect the modem GSM by USB to the server where nagios is hosted.
In this tuto we will show to how to configure Nagios to send sms hosted in Vmware.
Next step is to add usb controller to the nagios server.

Then choose your mobile phone.

Then check your configuration using dmesg | grep tty. You should see usb port (ttyACM0)

Now you need to install the smstool under nagios server using the flowing command in centos:
yum install smstools Make Sure you have the Following SMSTOOLS3 SERVER Files and Folders Installed
  • incoming = /var/spool/sms/incoming
  • outgoing = /var/spool/sms/outgoing
  • checked = /var/spool/sms/checked
  • failed = /var/spool/sms/failed
  • sent = /var/spool/sms/sent
  • logfile = /var/log/smsd.log
  • Configuration = /etc/smsd.conf
Also make sure that SMSTools has the Right Configuration Setting for your modem in: /etc/smsd.conf
( GSM Modem is on ttyACM0 in this example)
device = /dev/ttyACM0 Next step is to configure smstool service to autorun with the server.
chkconfig smsd on Then restart the service using this command:

service smsd restart Then you can test to send sms
sendsms 12128654549 'test' Nagios Configuration

After this go under /usr/local/nagios/etc/objects/ and edit the file commands.cfg but that perform a backup of the config file:
cd /usr/local/nagios/etc/objects/ cp commands.cfg commands.cfg.old Edit the commands.cfg file and you will add two commands ‘notify-host-by-sms’ and ‘notify-service-by-sms’ notify-host-by-sms /usr/bin/printf “%b” ” hostname : $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Date/Time: $DATE$ ” | smssend $CONTACTPAGER$ notify-host-by-whatsapp
/usr/bin/printf “%b” ” $SERVICEDESC$ State: $SERVICESTATE$ Date/Time: $LONGDATETIME$ ” | smssend $CONTACTPAGER$ And we should define the contact under contacts.cfg file like this example
contact_name admin use generic-contact alias Admin email admin@unixmen.com pager xxxxxxxxxxxxxxxxxxxxx service_notification_commands notify-service-by-email notify-service-by-sms host_notification_commands notify-host-by-email notify-host-by-sms Now the configuration is finished. Before applying the new configuration, run the following command to check for any error or mistake:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg If there are no errors, restart the nagios service:
service nagios restart

Tham khảo: https://www.unixmen.com/send-nagios-...ion-using-sms/
https://exchange.nagios.org/director...ations/details
  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 10:02 PM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.