How configure Zabbix SMS API

Configurando Zabbix SMS Script

In this article, I will teach you, with a step-by-step tutorial, how to set up an SMS sending script in Zabbix via the Nvoip API.

What is Zabbix?

Zabbix is one of the best known and most widely used open source tools in the world for monitoring networks, servers and services. It provides monitoring metrics, history and also allows you to perform actions on monitored services.

A monitoring tool is indispensable in the life of any team, IT professional or company that operates with technology as the foundation of their business.

But keeping track of Zabbix charts day and night can be a daunting and almost impossible task for a human being, so Zabbix natively offers media types, which are channels where the user can be notified if any problems occur.

What media types can I use on Zabbix?

By default, you can set up an SMTP server and receive email if an incident happens. The problem is that if you don’t have your email open, you probably won’t see it in time to resolve the incident in the shortest possible time.

There is also a function of using a GSM gateway in Zabbix, but nowadays, many Zabbix servers are installed in the clouds, which would prevent the use of a GSM Gateway. Also, setting up a GSM gateway takes longer than setting up an SMS API.

Why use SMS on Zabbix?

SMS is an alert that will draw more attention than an email. You can be at a party or sleeping, which, when the SMS arrives, will ring or vibrate your phone, catching your eye.

What do I need to set up SMS sending in Zabbix?

In this tutorial you will need the following items to configure SMS Alert on Zabbix:

  • Zabbix Server (In this tutorial we use a CentOS 7 Linux Server running Zabbix 4.2).
  • Basic knowledge in Linux to access your server and enter the script.
  • Token Nvoip (If you don’t have a Nvoip account yet, create a free account and earn BRL5 in credits in painel nvoip)


Knowledge: Basic

Estimated time: 10 minutes

Access our Zabbix repository on GitHub, to get the updated script.

Let’s understand the script. The code is commented for ease.

The $1, $2, $3 and $4 variables will be passed by Zabbix, and the $1 variable must be the cell phone that will receive the SMS.

Você deve gostar também:  How make a call to most important cities on Brazil?

The script will be executed by Zabbix every time an incident is triggered, firing the data to our API.

Attention: You only need to change the token_auth variable with your Nvoip token.


#Nvoip - SMS

#Copyright (C) 2020 Nvoip Plataforma Telefonia Ltda
#Leandro Campos <>

#This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

#You should have received a copy of the GNU General Public License along with this program.  If not, see <>.

###Inicio do Script###
# Seu Token da Nvoip. Acesse, crie sua para ter acesso ao seu Token.
# English: Your Nvoip Token. Visit, create yours to have access to your Token.

token_auth="TOKEN NVOIP"

#$1, $2, $3 e $4 são os parâmetros, em ordem, que você define no seu Servidor Zabbix. O $1 é o número que irá receber a chamada. Você pode reduzir, alterar a ordem ou acrescentar mais parâmetros.
#English: $1, $2, $3 and $4 are parameters, in order, that you set in your Zabbix Server. $ 1 is the number that will receive the call. You can reduce, change the order or add more parameters.

curl --include 
     --request POST 
     --header "Content-Type: application/json" 
     --header "token_auth: $token_auth" 
     --data-binary "{
    "msg":"$2 $3 $4"

Refer to the path of your Zabbix installation where scripts should be placed in the zabbix_server.conf file. This file is usually in /etc/zabbix/zabbix_server.conf.

Copy the file into the script directory. (In our case, the script directory is /usr/lib/zabbix /alertscripts).

Set file permissions:

chown zabbix:zabbix (Verifique qual usuário você usou no se Zabbix)
chmod 777

Go to your Zabbix and go to Administration> Media Types and click create media type. Use the information below:

Configuração Nova Mídia Envio SMS Zabbix pela Nvoip.
Name: SMS Nvoip
Type: Script
Script Name:
Script parameters:
Enabled: Yes

Note: See the image that I marked the fields that are the variables that Zabbix sends to the SMS Send Script. With the exception of the $1 variable in the first field, you can send other variables, see your Zabbix version documentation for possible variables. Just remember the 160 character limit per SMS.

Go to Administration > Users and select the user who will receive SMS. Click on Media and then Add. Configure with the data below:

Configuração Mídia SMS Usuário Zabbix.
Type: SMS Nvoip
Send To: (Enter here the cell phone that will receive the SMS (Currently only Brazilian cell phones.) Format: DDD + Number. Example: 11911112222.
When Active: 1-7,00:00-24:00 (Or according to your preference)
Use if severity: Check the trigger severity options that will trigger SMS.
Enabled: Sim

Ready. To test you can go back to Administration> Media Types and fire or trigger an incident.

Você deve gostar também:  How make a call to most important cities on Brazil?

If you prefer, access the video of this tutorial on our Youtube Channel by or see below:

Liked? Share. Encourage us to put more content like this on our social networks.

PHP Code Snippets Powered By :