Hi guys.
I successfully created an alert rule for my apc ups.
I can generate an alarm when runtime falls under 30min.
Problem is that when runtime is restablished can not properly get current value to print on the template:
Take a look to test-template.php output.
[[email protected]_wiber scripts]# php test-template.php -t14 -r23 -h 172.30.18.200
Array
(
[hostname] => 172.30.18.200
[sysName] => ups_bv
[sysDescr] => APC Web/SNMP Management Card (MB:v3.9.2 PF:v3.6.1 PN:apc_hw02_aos_361.bin AF1:v3.5.8 AN1:apc_hw02_sumx_358.bin MN:AP9619 HR:A10 SN: BA0930027668 MD:07/25/2009) (Embedded PowerNet SNMP Agent SW v2.2 compatible)
[sysContact] => Unknown
[os] => apc
[type] => power
[ip] =>
[hardware] => Smart-UPS 750 651.18.I
[version] => AOS v3.6.1 / App v3.5.8
[serial] =>
[features] =>
[location] => LUJAN_BV
[uptime] => 4142955
[uptime_short] => 47d 22h 49m 15s
[uptime_long] => 47 days 22 hours 49 minutes 15 seconds
[description] =>
[notes] =>
[alert_notes] =>
[device_id] => 28
[rule_id] => 23
[id] => 3680
[proc] =>
[status] => 1
[status_reason] =>
[ping_timestamp] =>
[ping_loss] => 0
[ping_min] => 3.99
[ping_max] => 6.09
[ping_avg] => 4.73
[debug] => Array
(
)
[title] => LIBRENMS: ALERTAS DE TIEMPO DE UPS REESTABLECIDAS ✅
[elapsed] => 14m 55s
[faults] => Array
(
[1] => Array
(
[device_id] => 28
[inserted] => 2020-09-30 14:19:50
[hostname] => 172.30.18.200
[sysName] => ups_bv
[ip] =>
[overwrite_ip] =>
[community] => public
[authlevel] =>
[authname] =>
[authpass] =>
[authalgo] =>
[cryptopass] =>
[cryptoalgo] =>
[snmpver] => v1
[port] => 161
[transport] => udp
[timeout] =>
[retries] =>
[snmp_disable] => 0
[bgpLocalAs] =>
[sysObjectID] => .1.3.6.1.4.1.318.1.3.2.7
[sysDescr] => APC Web/SNMP Management Card (MB:v3.9.2 PF:v3.6.1 PN:apc_hw02_aos_361.bin AF1:v3.5.8 AN1:apc_hw02_sumx_358.bin MN:AP9619 HR:A10 SN: BA0930027668 MD:07/25/2009) (Embedded PowerNet SNMP Agent SW v2.2 compatible)
[sysContact] => Unknown
[version] => AOS v3.6.1 / App v3.5.8
[hardware] => Smart-UPS 750 651.18.I
[features] =>
[location_id] => 12
[os] => apc
[status] => 1
[status_reason] =>
[ignore] => 0
[disabled] => 0
[uptime] => 4141454
[agent_uptime] => 0
[last_polled] => 2020-11-17 12:35:10
[last_poll_attempted] =>
[last_polled_timetaken] => 6.67
[last_discovered_timetaken] => 20.34
[last_discovered] => 2020-11-17 06:38:01
[last_ping] => 2020-11-17 12:35:10
[last_ping_timetaken] => 6.86
[purpose] =>
[type] => power
[serial] => AS0945141318
[icon] => apc.svg
[poller_group] => 0
[override_sysLocation] => 0
[notes] =>
[port_association_mode] => 1
[max_depth] => 0
[disable_notify] => 0
[sensor_id] => 1069
[sensor_deleted] => 0
[sensor_class] => runtime
[poller_type] => snmp
[sensor_oid] => .1.3.6.1.4.1.318.1.1.1.2.2.3.0
[sensor_index] => upsAdvBatteryRunTimeRemaining.0
[sensor_type] => apc
[sensor_descr] => Runtime
[group] =>
[sensor_divisor] => 6000
[sensor_multiplier] => 1
[sensor_current] => 24 <<=======this is not ok
[sensor_limit] => 3000
[sensor_limit_warn] => 2000
[sensor_limit_low] => 30
[sensor_limit_low_warn] => 60
[sensor_alert] => 1
[sensor_custom] => No
[entPhysicalIndex] =>
[entPhysicalIndex_measured] =>
[lastupdate] => 2020-11-17 12:35:05
[sensor_prev] => 26
[user_func] =>
[string] => sysObjectID => .1.3.6.1.4.1.318.1.3.2.7; sysDescr => APC Web/SNMP Management Card (MB:v3.9.2 PF:v3.6.1 PN:apc_hw02_aos_361.bin AF1:v3.5.8 AN1:apc_hw02_sumx_358.bin MN:AP9619 HR:A10 SN: BA0930027668 MD:07/25/2009) (Embedded PowerNet SNMP Agent SW v2.2 compatible); location_id => 12; sensor_id => 1069; sensor_oid => .1.3.6.1.4.1.318.1.1.1.2.2.3.0; sensor_descr => Runtime;
)
)
[builder] => {"condition":"AND","rules":[{"id":"sensors.sensor_current","field":"sensors.sensor_current","type":"string","input":"text","operator":"less_or_equal","value":"`sensors.sensor_limit_low`"},{"id":"sensors.sensor_alert","field":"sensors.sensor_alert","type":"string","input":"text","operator":"equal","value":"1"},{"id":"macros.device_up","field":"macros.device_up","type":"integer","input":"radio","operator":"equal","value":"1"},{"id":"sensors.sensor_class","field":"sensors.sensor_class","type":"string","input":"text","operator":"equal","value":"runtime"}],"valid":true}
[uid] => 3682
[alert_id] => 318
[severity] => warning
[rule] =>
[name] => tecnet_ups_apc_runtime
[timestamp] => 2020-11-17 12:40:12
[contacts] => Array
(
)
[state] => 0 <==============as you can see alarm is clear now
[alerted] => 0
[msg] => LIBRENMS: ALERTAS DE TIEMPO DE UPS REESTABLECIDAS ✅
Rule: tecnet_ups_apc_runtime
Time elapsed: 14m 55s
Timestamp: 2020-11-17 12:40:12
Unique-ID: 3682
Faults:
1:
Severidad: warning
Nodo: ups_bv
Sensor: Runtime
Valor minimo: 30 se ha restablecido
As you can see alarm si clear , runtime value is 54 minutes now but current value for the template is still 24.
Any ideas ?
Can not imagine where can I get proper value.
Leandro.