Everyone is aware of the need for continuous monitoring of a large distributed network and for this there are many monitoring systems. I note right away that I work for a major provider and, so to speak, shoulders my shoulders with monitoring the status of a large number of access nodes, which are often at a very large distance from me.
Now I am actively using the Zabbix 2.0 branch: I managed to fasten the constant monitoring of the parameters of the ADSL subscriber lines at all access nodes, about 200,000 parameters. Descriptions of how it was done will be enough for a separate article. I will tell you how to make the notification of any events via SMS in a simple and accessible way, and not to use for this specific hardware.
I will tell you how to make the notification of any events via SMS in a simple and accessible way, and not to use for this specific hardware.
')
Alert option using free email2sms features of the sms.ru service
UPD: In connection with the change of the corporate telecom operator, the way email2sms from biline is no longer acceptable for me. Found an interesting offer in the form of a web service
sms.ru What attracted me to it? Firstly, when registering as a programmer, we get the following items:
- Advanced API - you can send messages, check their status, find out the cost, check the balance through simple HTTP requests.
- The ability to replace the sender - as the sender can use the Latin name of your website or company
- Messages to own number
- Free up to 60 SMS per day, then paid at standard rates.
- SMS to your number is free only if the text fits into 1 SMS message
- e-mail2sms
Registration is simple, the phone will receive a confirmation in the form of SMS. I registered as a programmer.
Actually, in order not to go beyond free SMS, it is enough to observe the following conditions
- No more than 10 SMS to numbers other than theirs used at registration. The limit, cost, status of the message can be checked by simple queries.
- No more than 160 Latin characters in SMS.
- No more than 60 SMS to your number
By default, the sender will be your number specified during registration, it seemed to me not beautiful and I sent a request to the name of the zabbix sender from the control panel, the application was not reviewed for a long time, maybe 2 hours maybe and I began to receive messages from the zabbix sender.
Email2sms setting
Select the menu item Applications - Mail @ sms.ru. Something like this will open:

Click edit and see the following image:

Go through the points
- The first is your address of the form xxx @ sms.ru to which you need to send email notifications
- Tick ​​off
- Tick ​​off (I do not need the name of the action)
- Put a tick
- Tick ​​set otherwise SMS will be paid
- We select from what sender the message will come (I already have the name zabbix)
- Put a tick
- Then we can enter additional phone numbers where SMS will be duplicated. those. sending a letter to one SMS box can receive several clients at once with different phones.
- Enter the addresses of the mailboxes from which emails will be sent to the email2sms inbox. If the field is left blank, then the letters will be paid.
Click save and it should be like this

Setup on the sms.ru service is over.
There are two ways to send messages
- Using smtp server services
- Using your mail server
Configure zabbix using smtp server service
Create a notification method for the first method.
Administration - Alert methods .

As an outgoing email, we specify our emai2sms issued by
sms.ruNow you need to assign a notification method to the user.
Administration - Users Select a user and select the
alert tab. Next
add

If necessary, adjust the levels and time for the alert.
Configure zabbix using your mail server
For the second method, using your mail server, which requires authorization, we will do another script-type notification method

The script is located in the
AlertScriptsPath (decree in the zabbix configuration files). In my case, this is
/ usr / local / share / zabbix / alertscripts /Script itself
Do not forget to give rights 755 to the file
zabbix_sendemai .
Now you need to assign a notification method to the user.
Administration - Users Select a user and select the
alert tab. Next
add
Create an action zabbix sending an alert via sms
Set up an action on a triggered trigger. For example, I took the trigger to drop the port fa 0/5 of the d-link switch. Go to
Settings - Actions - Create an action (event source - trigger)
On the action tab, set up so

On the tab, the condition is set as a condition trigger with the value of the problem

On the operation tab, we make the type of operation to
send a message, add a user and select the desired type of
send_email or
email sms.ru from the
user in
“send only” and do not forget to click the
update button and then
save .

If everything is done, a new action will appear.

Check sending sms
Put the port handles on long. When viewing an event, you can see a successful reaction to the event: text, sending address, sending time.

Photo of the screen of the phone to which the sms came with a delay of less than a minute.

Old making email2sms
The solution is completely free when using Beeline phones. (I have not studied other operators, but I will be glad if you tell me).
There is a site beonline.ru where you can learn how to enable the receipt of letters from an e-mail in the form of SMS-messages. This is done either by
calling to the toll-free number
06849909 or by sending the following command to number 784:
SIM ON-POCHTANASMS YES .
SMS
SIM> VKL-POSTANASMS YES will come
back (Your phone has the Postal address: 79031234567@sms.beemail.ru). <> - more.We remember this address, although what is there to memorize?
Everyone probably guessed that further it was necessary to set up notifications via e-mail to the address obtained above, but not everything is so simple. Zabbix does not allow standard means to send notifications via e-mail if the smtp server requires authentication.
There is a solution - using scripts that can be found
on the Zabbix forum . I used the
sendEmail option .
Create a zabbix_sendemail script with 755 access rights
Substituting the necessary data and save it in the directory specified as AlertScriptsPath in the configuration file /etc/zabbix/zabbix_server.conf
The next step is to create a new
Transmission type in the
Administration menu -
Transmission medium types .
In the description we write for example
send emailtype choose a
scriptScript name write
zabbix_sendemailWe save.
Specify the transmission medium for the user who will need to send SMS. This is done in the
Administration -
Users menu. Select the desired user click
add transfer medium .
Type - select
send emailSend - enter the received e-mail from Beeline
Further at will (it is better to leave the default).
Now you need to create an action on the trigger that will send us an SMS.
This is done in the
Settings -
Action menu.
Create an action on the inaccessibility of iron.
SMS Name
Event
TriggerThe default theme is
{TRIGGER.NAME}: {STATUS} (it doesn’t matter much since the SMS will come without a theme)
The default message is
{HOSTNAME} unreachable {STATUS}Post a recovery set if necessary to receive a message about the restoration and fill in by analogy with the above written
Next, select the conditions of action
I did, you can write the conditions that you need.
Calculation Type (A) and (B) and and (D) and (E)
(A) Host Group = “Especially Important”
(B) The trigger description contains "not available"
Trigger importance = “Emergency”
(D) Trigger Value = "PROBLEM"
(E) The time period in "1-7.08: 00-23: 59"
When all the conditions coincide, a message is sent.
We set up an operation for action
Type of operation
Send messageSend message
One userSend only
send emailThe default message set kryzhik.
We save.
The message will come if there is a triggered trigger containing in the description “unavailable” in the group of network nodes “especially important” and all days of the week from 8 am to 12 at night.
And so we received an SMS notification system without using any complicated or paid solutions.
UPD The second article "Automatic renaming of hosts in Zabbix, according to data from snmp sysName"