OpenWrt and GS1900 oxidized backup triggers

Hello, wonderful community,

I use LNMS to manage an environment of commodity equipment for a home lab composed of LinkSys OpenWrt devices and managed Zyxel switches. I’ve rigged in Oxidized to work together in a questionable way after noticing support did not exist for these device OS’ in the supplied scripts/syslog-notify-oxidized.php external integration hook script (and for good reason due to inconsistent or limited patterns within syslog). I made the following (add) modification to the file’s ifelse block:

} elseif (preg_match('/is set to/', $msg, $matches)) {
    oxidized_node_update($hostname, $msg); //ZyNOSGS
} elseif (preg_match('/CONFIG_CHANGED/', $msg, $matches)) {
    oxidized_node_update($hostname, $msg); //OpenWrt
}

Here’s the section of my config.php registering the hooks to call this script for ZyNOS (ZyXel) and OpenWrt:

$config['enable_syslog'] = 1;
$config['enable_syslog_hooks'] = 1;

$config['os']['zynos']['syslog_hook'][] = Array('regex' => '/is set to/', 'script' => '/opt/librenms/scripts/syslog-notify-oxidized.php');
$config['os']['openwrt']['syslog_hook'][] = Array('regex' => '/CONFIG_CHANGE/', 'script' => '/opt/librenms/scripts/syslog-notify-oxidized.php');

Patterns:

For ZyNos (which is a terse logger even in debug mode), I noticed the only pattern on a configuration change was “$setting is set to $value”. Hence the “/is set to/” regex.

For OpenWrt I’m using a custom notifywait script that watches /etc on OpenWrt systems and uses logger to send messages with CONFIG_CHANGE that LNMS can pick up.

Questions:

  1. Is this approach I am taking the proper/recommended way with LibreNms? Is there a better way?
  2. Is this information/approach worthwhile being added back to the hook script? I can provide a PR and additional information/scripts on how to jig OpenWrt if it helps others.

Thanks in advance,
Alex