-
-
Notifications
You must be signed in to change notification settings - Fork 10
Monitoring with zabbix
Steps:
- get the data out of Assimbly using the REST service
- create the input file for zabbix_sender executable
- create zabbix items and triggers for your data
Create a REST client in any programming language you want (i will include a groovy example later)
Get an initial token by calling this URL and store the parameter XSRF-TOKEN it in a cookie named X-XSRF-TOKEN
GET http://your_assimbly_server:assimbly_port/api/account
Post the login form data to (make sure you re-use your cookie data from the previous step)
POST http://your_assimbly_server:assimbly_port/api/authentication
Retrieve all flows from the assimbly instance
GET http://your_assimbly_server:assimbly_port/api/flows?page=0&size=250&sort=name,asc
Loop through the retrieved JSON with flowdata and GET their stats.
Use these parameters from each object for the stats request:
<object>.gatewayId => <Gateway ID>
<object>.id => <Flow ID>
GET http://your_assimbly_server:assimbly_port/api/connector/<Gateway ID>/flow/stats/<Flow ID>
Save the retrieved data in a textfile, values are separated by a <space>
hostname zabbixkeyname unixtimestamp value
for example:
ASSIMBLYSERVER01 flow.status[flow_name_from_a_to_b] 1600947605 started
ASSIMBLYSERVER01 flow.autostart[flow_name_from_a_to_b] 1600947605 true
ASSIMBLYSERVER01 flow.alertcount[flow_name_from_a_to_b] 1600947605 1
ASSIMBLYSERVER01 flow.lastexchangefailureexchangeid[flow_name_from_a_to_b] 1600947605 0
ASSIMBLYSERVER01 flow.firstexchangefailuretimestamp[flow_name_from_a_to_b] 1600947605 0
ASSIMBLYSERVER01 flow.firstexchangecompletedexchangeid[flow_name_from_a_to_b] 1600947605 ID-1221
ASSIMBLYSERVER01 flow.lastexchangecompletedtimestamp[flow_name_from_a_to_b] 1600947605 2020-09-24T12:13:49
ASSIMBLYSERVER01 flow.exchangescompleted[flow_name_from_a_to_b] 1600947605 9
This file can be sent to Zabbix using the following command:
zabbix_sender.exe -vv -c zabbix_agentd.win.conf -T -i zabbix_data_file.txt
Example zabbix template
You should replace {flowname} for your own flow name as in your text file sent to zabbix. Copy all items and triggers from the example below for each flow you want to monitor.
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.2</version>
<date>2020-08-24T08:37:37Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Assimbly Flow Status</template>
<name>Assimbly Flow Status</name>
<description/>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Assimbly</name>
</application>
</applications>
<items>
<item>
<name>flow autostart $1</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.autostart[{flowname}]</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>4</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Assimbly</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>flow status $1</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.status[{flowname}]</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>4</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Assimbly</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>flow alert count $1</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.alertcount[{flowname}]</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Assimbly</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>flow failureshandled count $1</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.failureshandled[{flowname}]</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Assimbly</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>flow exchangescompleted count $1</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.exchangescompleted[{flowname}]</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Assimbly</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
</items>
</template>
</templates>
<triggers>
<trigger>
<expression>{Assimbly Flow Status:flow.alertcount[{flowname}].min(15m)}>10</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>flow alert count is high: {flowname}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>2</priority>
<description>> 10 alert messages on flow {flowname}</description>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
<trigger>
<expression>{Assimbly Flow Status:flow.alertcount[{flowname}].nodata(1h)}<>0</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>Flow no data for {ITEM.NAME<1>} on {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
<trigger>
<expression>{Assimbly Flow Status:flow.autostart[{flowname}].str(true)}=1 and {Assimbly Flow Status:flow.status[{flowname}].str(started)}=0</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>flow is not started: {flowname}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>2</priority>
<description>flow startup type = auto but state not "started"</description>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
</triggers>
</zabbix_export>