Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.2</version>
<date>2017-02-26T04:08:53Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template App Alarm Decoder</template>
<name>Template App Alarm Decoder</name>
<description>Alarm Decoder serial output logging analysis&#13;
&#13;
http://www.alarmdecoder.com/&#13;
&#13;
$ sudo ./ser2sock -f ser2sock.conf&#13;
$ nohup ./readtolog.sh 127.0.0.1 10000 &amp;&#13;
$ cat readtolog.sh &#13;
#!/bin/bash&#13;
# http://stackoverflow.com/questions/38246267/bash-how-to-make-telnet-or-nc-work-in-background-until-connection-is-closed&#13;
ip=$1&#13;
port=$2&#13;
while [ 1 ]&#13;
do&#13;
nc -d $ip $port | while read line ; do echo `date +'%d%m%Y-%H%M%S'`: $line &gt;&gt;console-$ip-$port.txt; done&#13;
sleep .1&#13;
done&#13;
&#13;
&#13;
Example log lines:&#13;
$ grep &quot;FAULT&quot; console-127.0.0.1-10000.txt &#13;
25022017-212050: [...--],001,[...],&quot;FAULT 01 DOOR &quot;&#13;
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Alarm Decoder</name>
</application>
</applications>
<items>
<item>
<name>Zone fault value</name>
<type>7</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>log[{$ADLOGPATH},&quot;FAULT ([0-9]+)&quot;,,,,\1]</key>
<delay>60</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>
<application>
<name>Alarm Decoder</name>
</application>
</applications>
<valuemap>
<name>Alarm fault map</name>
</valuemap>
<logtimefmt/>
</item>
<item>
<name>File size of $1</name>
<type>7</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>vfs.file.size[{$ADLOGPATH}]</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>B</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>Alarm Decoder</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>File age of $1</name>
<type>7</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>vfs.file.time[{$ADLOGPATH}]</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>unixtime</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>Alarm Decoder</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
</items>
<discovery_rules/>
<httptests/>
<macros>
<macro>
<macro>{$ADLOGPATH}</macro>
<value>/path/to/ser2sock/console-127.0.0.1-10000.txt</value>
</macro>
</macros>
<templates/>
<screens/>
</template>
</templates>
<value_maps>
<value_map>
<name>Alarm fault map</name>
<mappings>
<mapping>
<value>1</value>
<newvalue>Door</newvalue>
</mapping>
</mappings>
</value_map>
</value_maps>
</zabbix_export>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment