From 7c10909d0680c4183fd3fa9e4246f81c849a4b99 Mon Sep 17 00:00:00 2001 From: Misha Komarovskiy Date: Sun, 12 Aug 2018 00:49:39 +0300 Subject: [PATCH] Added Juniper Junos syslog notification code (#9006) DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply `, i.e `./scripts/github-apply 5926` --- doc/Extensions/Syslog.md | 17 +++++++++++++++++ scripts/syslog-notify-oxidized.php | 2 ++ 2 files changed, 19 insertions(+) diff --git a/doc/Extensions/Syslog.md b/doc/Extensions/Syslog.md index 60501d07c3..6e3395b23c 100644 --- a/doc/Extensions/Syslog.md +++ b/doc/Extensions/Syslog.md @@ -202,6 +202,18 @@ logging librenms.ip logging server librenms.ip 5 use-vrf default facility local6 ``` +#### Juniper Junos +```config +set system syslog host librenms.ip authorization any +set system syslog host librenms.ip daemon any +set system syslog host librenms.ip kernel any +set system syslog host librenms.ip user any +set system syslog host librenms.ip change-log any +set system syslog host librenms.ip source-address +set system syslog host librenms.ip exclude-hostname +set system syslog time-format +``` + If you have permitted udp and tcp 514 through any firewall then that should be all you need. Logs should start appearing and displayed within the LibreNMS web UI. ### Windows @@ -248,3 +260,8 @@ $config['os']['nxos']['syslog_hook'][] = Array('regex' => '/%VSHD-5-VSHD_SYSLOG_ ```ssh $config['os']['iosxr']['syslog_hook'][] = Array('regex' => '/%GBL-CONFIG-6-DB_COMMIT/', 'script' => '/opt/librenms/scripts/syslog-notify-oxidized.php'); ``` + +#### Juniper Junos +```ssh +$config['os']['junos']['syslog_hook'][] = Array('regex' => '/%UI_COMMIT:/', 'script' => '/opt/librenms/scripts/syslog-notify-oxidized.php'); +``` diff --git a/scripts/syslog-notify-oxidized.php b/scripts/syslog-notify-oxidized.php index 2c2c967635..d4ddbafebf 100755 --- a/scripts/syslog-notify-oxidized.php +++ b/scripts/syslog-notify-oxidized.php @@ -31,4 +31,6 @@ if (preg_match('/(SYS-(SW[0-9]+-)?5-CONFIG_I|VSHD-5-VSHD_SYSLOG_CONFIG_I): Confi 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.+?)\\\\\' .*/', $msg, $matches)) { + oxidized_node_update($hostname, $msg, $matches['user']); }