Saturday, September 3, 2016

[Zabbix] How to use Amazon SNS free (US only) SMS notification for Zabbix Monitoring

Amazon provides a notification service which also can send SMS. For US phone numbers the first 100 a month a free and this a nice thing to use for Zabbix monitoring.

To do that we'll need the following steps:

1. install aws-cli (http://docs.aws.amazon.com/cli/latest/userguide/installing.html)
2. create a Access Key ID and Secret Access Key
3. under SNS service create a new topic
4. create new subscription to that topic for each phone number you want to add
5. Protocol: SMS, Endpoint: your phone number
6. copy the Topic ARN
7. on a Debian system create /var/lib/zabbix and chown it for zabbix:zabbix
8. run: su -c 'aws configure' -s /bin/sh zabbix , and enter the both keys, then a region e.g. us-east-1 and the last leave empty. see http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
9. configure your action, under Operations of your Action, select Operation Type : Remote Command, select Execute on : Zabbix Server and enter following Command: aws sns publish --topic-arn arn:aws:sns:us-east-1:3062343543543:example --message "URGENT: INFRASTRUCTURE ISSUE"

[Zabbix] How to use active Agents

In the Agent config you have to have ServerActive=$zabbixip:10051 (it is not 10050!). Hostname=yourmachinehostname.

Unlink all templates from the host.

Then you have to clone zabbix agent template and OS linux template. Call them e.g. OS Linux Active. Go to each Item list, mark all items, go Mass Update, then change type to Zabbix Agent Active. The same for all discovery items.

Restart the Zabbix-Agent and wait a few minutes.