First time I’ve actually remembered to ask here rather than on github
Allied Telesis AW+ products will have a syslog log message when the user saves the config in the next software release (5.4.8-2.1) which is due out in I think early Nov.
There will also be a line now (again similar to other vendors) at the top of the config with a time stamp and who last saved the device config.
As such, I want to add support for this enhancement in LibreNMS so when a user saves the config, the syslog hook will cause oxidized to auto login and pull the latest config.
I haven’t got this working yet, and I’m just wondering what I need to do.
Is there a way to debug whether the hook below is actually triggering the script?
$config['os']['awplus']['syslog_hook'][] = Array('regex' => '/IMI\[[0-9]+\]: Startup-config saved on/',
'script' => '/opt/librenms/scripts/syslog-notify-oxidized.php');
This is the log message:
2018-09-06T23:08:34+12:00 user.notice c1-x908-stk IMI[1059]: Startup-config saved on Thu Sep 6 23:08:32 2018 +1200 by manager via con0 (ttyS0)
And from LibreNMS:
Then in /scripts/syslog-notify-oxidized.php
elseif (preg_match('/IMI\[[0-9]+\]:\sStartup configuration saved by (?P<user.+)+ via ().*/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']);
I’m aware above won’t work as it doesn’t skip the timestamp in the log message (this is new), but I’m first of all just trying to figure out whether the initial hook is actually working. Thoughts on how?
Thanks