-
-
Notifications
You must be signed in to change notification settings - Fork 9
Monitoring with zabbix
In this tutorial you learn how to monitor an Assimbly Flow with Zabbix
Zabbix is an open source monitoring tool. It can alert you when something is wrong in Assimbly. The main flow to get data from Assimbly to Zabbix is as follow:
Main steps:
- Get the data out of Assimbly using the REST API
- 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 flowname 0 {"data":[{"{#FLOWNAME}":"flow_name_from_a_to_b"}]}
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
The first line in this example is used for auto-discovery
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 with auto discovery
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.2</version>
<date>2020-10-09T11:34:16Z</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/>
<items/>
<discovery_rules>
<discovery_rule>
<name>Assimbly flows in Discovery</name>
<type>2</type>
<snmp_community/>
<snmp_oid/>
<key>flowname</key>
<delay>0</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<delay_flex/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>
<evaltype>0</evaltype>
<formula/>
<conditions/>
</filter>
<lifetime>10</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name>flow alert count {#FLOWNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.alertcount[{#FLOWNAME}]</key>
<delay>0</delay>
<history>90</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/>
<valuemap/>
<logtimefmt/>
<application_prototypes>
<application_prototype>
<name>Assimbly</name>
</application_prototype>
</application_prototypes>
</item_prototype>
<item_prototype>
<name>flow autostart {#FLOWNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.autostart[{#FLOWNAME}]</key>
<delay>0</delay>
<history>90</history>
<trends>0</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/>
<valuemap/>
<logtimefmt/>
<application_prototypes>
<application_prototype>
<name>Assimbly</name>
</application_prototype>
</application_prototypes>
</item_prototype>
<item_prototype>
<name>flow exchangescompleted count {#FLOWNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.exchangescompleted[{#FLOWNAME}]</key>
<delay>0</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>2</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/>
<valuemap/>
<logtimefmt/>
<application_prototypes>
<application_prototype>
<name>Assimbly</name>
</application_prototype>
</application_prototypes>
</item_prototype>
<item_prototype>
<name>flow failureshandled count {#FLOWNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.failureshandled[{#FLOWNAME}]</key>
<delay>0</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>2</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/>
<valuemap/>
<logtimefmt/>
<application_prototypes>
<application_prototype>
<name>Assimbly</name>
</application_prototype>
</application_prototypes>
</item_prototype>
<item_prototype>
<name>flow redeliveries count {#FLOWNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.redeliveries[{#FLOWNAME}]</key>
<delay>0</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>2</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/>
<valuemap/>
<logtimefmt/>
<application_prototypes>
<application_prototype>
<name>Assimbly</name>
</application_prototype>
</application_prototypes>
</item_prototype>
<item_prototype>
<name>flow status {#FLOWNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>flow.status[{#FLOWNAME}]</key>
<delay>0</delay>
<history>90</history>
<trends>0</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/>
<valuemap/>
<logtimefmt/>
<application_prototypes>
<application_prototype>
<name>Assimbly</name>
</application_prototype>
</application_prototypes>
</item_prototype>
</item_prototypes>
<trigger_prototypes>
<trigger_prototype>
<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} on {HOST.NAME}</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_prototype>
<trigger_prototype>
<expression>{Assimbly Flow Status:flow.failureshandled[{#FLOWNAME}].last()}>0</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>flow failures count rising: {#FLOWNAME} on {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger_prototype>
<trigger_prototype>
<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} on {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger_prototype>
<trigger_prototype>
<expression>{Assimbly Flow Status:flow.alertcount[{#FLOWNAME}].nodata(1h)}<>0</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>Flow no data for {#FLOWNAME} 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_prototype>
</trigger_prototypes>
<graph_prototypes/>
<host_prototypes/>
</discovery_rule>
</discovery_rules>
<httptests/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
</zabbix_export>