librenms-librenms/scripts/syslog-notify-oxidized.php
mattie47 22f07914e8 device: Add Allied Telesis oxidized syslog hook support (#9219)
This patch adds support for Allied Telesis AW+ devices running at
least 5.4.8-2.1 the ability to automatically have oxidized pull
configs when the device config has been saved.

Syslog hook for LibreNMS config.php
$config['os']['awplus']['syslog_hook'][] = Array
  ('regex' => '/IMI.+.Startup-config saved on/',
    'script' => '/opt/librenms/scripts/syslog-notify-oxidized.php');

Note: V5.4.8-2.1 should be released on roughly Nov 2 2018.

Refer to the following for latest release notes:

https://www.alliedtelesis.com/documents/release-notes-alliedware-plus-548
2018-09-18 10:31:40 -05:00

28 lines
1.4 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
$init_modules = [];
require __DIR__ . '/../includes/init.php';
use LibreNMS\Config;
$hostname = $argv[1];
$os = $argv[2];
$msg = $argv[3];
if (preg_match('/(SYS-(SW[0-9]+-)?5-CONFIG_I|VSHD-5-VSHD_SYSLOG_CONFIG_I): Configured from .+ by (?P<user>.+) on .*/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']);
} elseif (preg_match('/GBL-CONFIG-6-DB_COMMIT : Configuration committed by user \\\\\'(?P<user>.+?)\\\\\'..*/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']);
} elseif (preg_match('/ASA-(config-)?5-111005: (?P<user>.+) end configuration: OK/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']);
} elseif (preg_match('/startup-config was changed by (?P<user>.+) from telnet client .*/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']);
} elseif (preg_match('/HWCM\/4\/CFGCHANGE/', $msg, $matches)) { //Huawei VRP devices CFGCHANGE syslog
oxidized_node_update($hostname, $msg);
} elseif (preg_match('/UI_COMMIT: User \\\\\'(?P<user>.+?)\\\\\' .*/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']);
} elseif (preg_match('/IMI.+.Startup-config saved on .+ by (?P<user>.+) via .*/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']); //Alliedware Plus devices. Requires at least V5.4.8-2.1
}