Trying to use test-template.php to tune/test my various alert templates, I have 3 stand-alone LibreNMS systems running at different locations, all on the same version – 2 work fine with test-template.php, one does not. When I run in debug mode, I see all of the mysql Select statements, but not the last Update statement. Then I get blank results – rather than the proper array values and sample alert that my other two machines produce. Samples below:
VALIDATE.PHP:
[root@librenms scripts]# …/validate.php
Component | Version |
---|---|
LibreNMS | 1.43-86-g5e9d032 |
DB Schema | 267 |
PHP | 7.2.7 |
MySQL | 5.5.56-MariaDB |
RRDTool | 1.4.8 |
SNMP | NET-SNMP 5.7.2 |
====================================
[OK] Composer Version: 1.7.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
SAMPLE TEST-TEMPLATE.PHP RESULTS:
[root@librenms scripts]# ./test-template.php -t 0 -r 1 -h localhost -d
SQL[SELECT device_id
FROM devices
WHERE hostname
= ? [“localhost”] 0.5ms]
SQL[SELECT alerts.id, alerts.device_id, alerts.rule_id, alerts.state, alerts.note FROM alerts WHERE alerts.device_id=26 && alerts.rule_id=1 [] 0.48ms]
SQL[SELECT alert_log.id,alert_log.rule_id,alert_log.device_id,alert_log.state,alert_log.details,alert_log.time_logged,alert_rules.rule,alert_rules.severity,alert_rules.extra,alert_rules.name,alert_rules.builder FROM alert_log,alert_rules WHERE alert_log.rule_id = alert_rules.id && alert_log.device_id = ? && alert_log.rule_id = ? && alert_rules.disabled = 0 ORDER BY alert_log.id DESC LIMIT 1 [26,1] 0.67ms]
SQL[SELECT DISTINCT a.* FROM alert_rules a
LEFT JOIN alert_device_map d ON a.id=d.rule_id
LEFT JOIN alert_group_map g ON a.id=g.rule_id
LEFT JOIN device_group_device dg ON g.group_id=dg.device_group_id
WHERE a.disabled = 0 AND ((d.device_id IS NULL AND g.group_id IS NULL) OR d.device_id=? OR dg.device_id=?) [26,26] 1.25ms]
SQL[SELECT hostname, sysName, sysDescr, sysContact, os, type, ip, hardware, version, location, purpose, notes, uptime FROM devices WHERE device_id = ? [26] 0.43ms]
SQL[SELECT * FROM devices_attribs WHERE device_id
= ? [26] 0.36ms]
SQL[SELECT timestamp
, loss
, min
, max
, avg
FROM device_perf
WHERE device_id
= ? ORDER BY timestamp
LIMIT 1 [26] 23.81ms]
SQL[select * from alert_templates
where exists (select * from alert_template_map
where alert_templates
.id
= alert_template_map
.alert_templates_id
and alert_rule_id
= ?) limit 1 [1] 0.65ms]
SQL[select * from alert_templates
where name
= ? limit 1 [“Default Alert Template”] 0.39ms]
SQL[SELECT alert_log.id,alert_log.time_logged,alert_log.details FROM alert_log WHERE alert_log.state != 2 && alert_log.state != 0 && alert_log.rule_id = ? && alert_log.device_id = ? && alert_log.id < ? ORDER BY id DESC LIMIT 1 [1,26,56] 0.48ms]
Array
(
[title] =>
[msg] =>
)