<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<formatVersion>4</formatVersion>
	<description>MT_Voltage_Export</description>
	<events>
		<event id="100023">
			<name>DCI_MT_VOLTAGE_OK</name>
			<guid>20b05fc1-e8e1-4986-833a-dd91a05e7a01</guid>
			<code>100023</code>
			<severity>0</severity>
			<flags>1</flags>
			<message>Voltage on MT OK</message>
			<description></description>
		</event>
		<event id="100022">
			<name>DCI_MT_VOLTAGE_BAD</name>
			<guid>79b13d23-d6ce-4e54-b191-108f713e7c00</guid>
			<code>100022</code>
			<severity>3</severity>
			<flags>1</flags>
			<message>Bad voltage on MT (running on batteries???)</message>
			<description></description>
		</event>
	</events>
	<templates>
		<template id="8832">
			<guid>fc6aee95-f013-44a9-8057-dac9fa8fbf07</guid>
			<name>MTVoltage</name>
			<flags>3</flags>
			<path>
				<element id="1">MT</element>
			</path>
			<dataCollection>
				<dci id="149246">
					<guid>d5921618-575f-44c4-b370-bb946335749f</guid>
					<name>1.3.6.1.4.1.14988.1.1.3.8.{instance}</name>
					<description>auto_MT_volt2</description>
					<dataType>0</dataType>
					<samples>0</samples>
					<origin>2</origin>
					<interval>900</interval>
					<retention>0</retention>
					<instance></instance>
					<systemTag></systemTag>
					<delta>0</delta>
					<flags>0</flags>
					<snmpRawValueType>0</snmpRawValueType>
					<snmpPort>0</snmpPort>
					<instanceDiscoveryMethod>4</instanceDiscoveryMethod>
					<instanceRetentionTime>-1</instanceRetentionTime>
					<transformation></transformation>
					<thresholds>
						<threshold id="1">
							<function>6</function>
							<condition>0</condition>
							<value>0</value>
							<activationEvent>DCI_MT_VOLTAGE_BAD</activationEvent>
							<deactivationEvent>DCI_MT_VOLTAGE_OK</deactivationEvent>
							<sampleCount>1</sampleCount>
							<repeatInterval>-1</repeatInterval>
							<script>voltage_now = $1;&#x0A;threshold = GetCustomAttribute($node, &quot;mt_ref_voltage_threshold&quot;);&#x0A;&#x0A;if (threshold != null)&#x0A;{&#x0A;    if (voltage_now &lt;= threshold)&#x0A;    {&#x0A;    &#x09;return true;&#x0A;    }&#x0A;    else&#x0A;    {&#x0A;      return false;&#x0A;    }&#x0A;}&#x0A;</script>
						</threshold>
					</thresholds>
					<perfTabSettings>&lt;config&gt;&#x0A;   &lt;enabled&gt;true&lt;/enabled&gt;&#x0A;   &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A;   &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A;   &lt;stacked&gt;false&lt;/stacked&gt;&#x0A;   &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A;   &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A;   &lt;minYScaleValue&gt;1&lt;/minYScaleValue&gt;&#x0A;   &lt;maxYScaleValue&gt;100&lt;/maxYScaleValue&gt;&#x0A;   &lt;timeRange&gt;6&lt;/timeRange&gt;&#x0A;   &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A;   &lt;type&gt;0&lt;/type&gt;&#x0A;   &lt;color&gt;49152&lt;/color&gt;&#x0A;   &lt;title&gt;Voltage&lt;/title&gt;&#x0A;   &lt;name&gt;Voltage&lt;/name&gt;&#x0A;   &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A;   &lt;groupName&gt;&lt;/groupName&gt;&#x0A;   &lt;order&gt;100&lt;/order&gt;&#x0A;   &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A;   &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A;   &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
					<instanceDiscoveryData>.1.3.6.1.4.1.14988.1.1.3.8</instanceDiscoveryData>
					<instanceFilter>transport = CreateSNMPTransport($node);&#x0A;if (transport == null)&#x0A;{&#x0A;    return false;&#x0A;}&#x0A; &#x0A;voltage = SNMPGetValue(transport, &quot;.1.3.6.1.4.1.14988.1.1.3.8.0&quot;);&#x0A;if (voltage == null)&#x0A;{&#x0A;    return false;&#x0A;}&#x0A;else&#x0A;{&#x0A;&#x09;if (voltage == 0)&#x0A;&#x09;{&#x0A;&#x09;  return false;&#x0A;&#x09;}&#x0A;&#x09;AttrVoltage = GetCustomAttribute($node, &quot;mt_ref_voltage&quot;);&#x0A;&#x09;if (AttrVoltage == null)&#x0A;&#x09;{ &#x0A;&#x09;&#x09;SetCustomAttribute($node, &quot;mt_ref_voltage&quot;, voltage);&#x0A;&#x09;}&#x0A;&#x09;&#x0A;&#x09;AttrThreshold = GetCustomAttribute($node, &quot;mt_ref_voltage_threshold&quot;);&#x0A;&#x0A;&#x09;if (AttrThreshold == null)&#x0A;&#x09;{ &#x0A;&#x09;&#x09;AttrVoltage = GetCustomAttribute($node, &quot;mt_ref_voltage&quot;);&#x0A;&#x09;&#x09;//Threshold: approx 15% drop of reference voltage&#x0A;&#x09;   threshold = round(AttrVoltage - (0.15 * AttrVoltage));&#x0A;&#x09;&#x09;SetCustomAttribute($node, &quot;mt_ref_voltage_threshold&quot;, threshold);&#x0A;&#x09;}&#x0A;&#x09;&#x0A;   return true;&#x0A;}</instanceFilter>
				</dci>
			</dataCollection>
			<filter>return $node-&gt;driver  == &quot;MIKROTIK&quot;;</filter>
		</template>
	</templates>
	<traps>
	</traps>
	<rules>
		<rule id="49">
			<guid>7a6c9146-f11d-4546-9a52-ace71998a89e</guid>
			<flags>7944</flags>
			<alarmMessage>%m</alarmMessage>
			<alarmKey>MT_VOLT_BAD_%i</alarmKey>
			<alarmSeverity>5</alarmSeverity>
			<alarmTimeout>0</alarmTimeout>
			<alarmTimeoutEvent>43</alarmTimeoutEvent>
			<script></script>
			<comments>MT VOLT  BAD</comments>
			<sources>
			</sources>
			<events>
				<event id="100022">
					<name>DCI_MT_VOLTAGE_BAD</name>
				</event>
			</events>
			<actions>
			</actions>
			<pStorageActions>
				<setValue>
				</setValue>
				<deleteValue>
				</deleteValue>
			</pStorageActions>
		</rule>
		<rule id="50">
			<guid>c7a4c997-b04e-4a33-a2ce-ac9147da8849</guid>
			<flags>7944</flags>
			<alarmMessage>%m</alarmMessage>
			<alarmKey>MT_VOLT_BAD_%i</alarmKey>
			<alarmSeverity>6</alarmSeverity>
			<alarmTimeout>0</alarmTimeout>
			<alarmTimeoutEvent>43</alarmTimeoutEvent>
			<script></script>
			<comments>MT VOLT OK</comments>
			<sources>
			</sources>
			<events>
				<event id="100023">
					<name>DCI_MT_VOLTAGE_OK</name>
				</event>
			</events>
			<actions>
			</actions>
			<pStorageActions>
				<setValue>
				</setValue>
				<deleteValue>
				</deleteValue>
			</pStorageActions>
		</rule>
	</rules>
	<scripts>
	</scripts>
	<objectTools>
	</objectTools>
	<dciSummaryTables>
	</dciSummaryTables>
	<actions>
	</actions>
</configuration>
