Catalogue
Zabbix + Reactio Integration

Zabbix + Reactio Integration

🌐 日本語で読む

Overview

With Reactio going free, its features have been unlocked, making it possible to integrate with various monitoring and alerting tools.
Taking this opportunity, I integrated Zabbix with Reactio and put together this summary.

Reactio is becoming free

Environment

  • Zabbix 3.0
  • CentOS Linux release 7.2.1511 (Core)

This assumes Zabbix 3.0 is already installed and running.

Host Configuration in the Zabbix Admin UI

* Skip this if it is already configured.

Configuration > Hosts > create

  • Host name: Project1

Creating a Reactio Project

Incidents are managed per project.

https://<Organization ID>.reactio.jp/settings/project

Use the Host name configured in the Zabbix admin UI as the Project name.

Issuing a Reactio API Key

On the same page as the project creation page, click the “+” button in the API section to issue an API KEY.

Installing zabbix-reactio

1
2
$ cd /usr/lib/zabbix/alertscripts
$ git clone http://github.com/zabbix-reactio

Configuring the Zabbix DB Info, the Reactio Project, and the Issued API KEY in the Config File

1
2
$ cd /usr/lib/zabbix/alertscripts/zabbix-reactio
$ vi config.inc
  • Set the DB info in db_info
  • Set <Organization ID>
  • Set Project = API KEY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[db_info]
host = <DB Host>
user = <DB user>
pass = <DB pass>
db = <DB name>

[reactio_url]
default = https://<Organization ID>.reactio.jp/api/v1/incidents

[api_key]
Project1 = <Project1's API KEY>
Project2 = <Project2's API KEY>
Project3 = <Project3's API KEY>
...
...

Adding a DB Column

  • Add a Reactio Incident ID column to the Zabbix alerts table.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ cd /usr/lib/zabbix/alertscripts/zabbix-reactio
$ mysql -h <DB Host> -u <DB user> -p<DB pass> <DB name> -e "`cat add_reactioincidentid.sql`"
$ mysql -h <DB Host> -u <DB user> -p<DB pass> <DB name> -e "SHOW COLUMNS FROM alerts"

+---------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+-----+---------+-------+
| alertid | bigint(20) unsigned | NO | PRI | NULL | |
| actionid | bigint(20) unsigned | NO | MUL | NULL | |
| eventid | bigint(20) unsigned | NO | MUL | NULL | |
| userid | bigint(20) unsigned | YES | MUL | NULL | |
| clock | int(11) | NO | MUL | 0 | |
| mediatypeid | bigint(20) unsigned | YES | MUL | NULL | |
| sendto | varchar(100) | NO | | | |
| subject | varchar(255) | NO | | | |
| message | text | NO | | NULL | |
| status | int(11) | NO | MUL | 0 | |
| retries | int(11) | NO | | 0 | |
| error | varchar(128) | NO | | | |
| esc_step | int(11) | NO | | 0 | |
| alerttype | int(11) | NO | | 0 | |
| reactio_incident_id | int(11) | NO | | 0 | | ← you can confirm it has been added
+---------------------+---------------------+------+-----+---------+-------+

In Reactio, every incident is managed by an ID.
When Zabbix sends a failure alert notification, it calls the Reactio create-incident API and saves the incident ID.

This incident ID is used when Zabbix sends a recovery alert notification and calls the Reactio update-incident-status API.

Zabbix Media types: Creating Reactio

Administration > Media types, click the Create media type button

Enter the following values and click the Add button

Item Value
Name Reactio
Type Script
Script name zabbix-reactio/reactio.php
Script Parameters 1 {ALERT.SUBJECT}
Script Parameters 2 {ALERT.MESSAGE}

Zabbix Users: Creating Reactio

Administration > Users, click the Create media type button

  • Create the Reactio user
  • Click the Media tab and enter the Media information
  • Click the Permission tab and select Zabbix Super Admin
  • Click the Add button and confirm it appears in the list

Zabbix Actions: Creating the Reactio Notification

Configuration > Actions, click the Create button

  • Select the Action tab and enter the Action information
Item Value
Name Reactio Notification
Default subject PROBLEM alert - {TRIGGER.NAME} is {TRIGGER.STATUS}
Default message HOST: {HOST.NAME}
TRIGGER_NAME: {TRIGGER.NAME}
TRIGGER_STATUS: {TRIGGER.STATUS}
TRIGGER_SEVERITY: {TRIGGER.SEVERITY}
DATETIME: {DATE} / {TIME}
ITEM_ID: {ITEM.ID1}
ITEM_NAME: {ITEM.NAME1}
ITEM_KEY: {ITEM.KEY1}
ITEM_VALUE: {ITEM.VALUE1}
EVENT_ID: {EVENT.ID}
TRIGGER_URL: {TRIGGER.URL}
Recovery message check
Recovery subject RECOVERY alert - {TRIGGER.NAME} is {TRIGGER.STATUS}
Recovery message HOST: {HOST.NAME}
TRIGGER_NAME: {TRIGGER.NAME}
TRIGGER_STATUS: {TRIGGER.STATUS}
TRIGGER_SEVERITY: {TRIGGER.SEVERITY}
DATETIME: {DATE} / {TIME}
ITEM_ID: {ITEM.ID1}
ITEM_NAME: {ITEM.NAME1}
ITEM_KEY: {ITEM.KEY1}
ITEM_VALUE: {ITEM.VALUE1}
EVENT_ID: {EVENT.ID}
TRIGGER_URL: {TRIGGER.URL}
Enabled check

The Reactio API is invoked based on the following items:

  • PROBLEM/RECOVERY in the subject
  • HOST: {HOST.NAME}
  • EVENT_ID: {EVENT.ID}

Even when reformatting the message, make sure to keep the items above.

  • Select the Operations tab and enter the Operations information

This completes the Reactio integration setup in Zabbix.

Results

  • The incident was created!
  • The status of the created incident was updated!

Going Forward

I have only just started operating this.
I plan to consider future updates, such as changing the message depending on the failure severity.

Please also try the Zabbix-Slack integration below.

zabbix3-slack

That’s all.
Thank you for your attention.

kenzo0107

kenzo0107