Oxidized update and Device remove (#13730)

* Oxidized + Device remove
Was just working on oxidized, but then to properly update nodes after delete, updated delete_device()

* revert dumb style changes

* baseline update and no DI there...

* Fix OS first load and device deletion missing tables
This commit is contained in:
Tony Murray
2022-01-29 21:09:05 -06:00
committed by GitHub
parent 29ff20d7eb
commit b6a8b602b8
19 changed files with 315 additions and 184 deletions

View File

@@ -8,22 +8,23 @@ $hostname = $argv[1];
$os = $argv[2];
$msg = $argv[3];
$oxidized_api = new \App\ApiClients\Oxidized();
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']);
$oxidized_api->updateNode($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']);
$oxidized_api->updateNode($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']);
$oxidized_api->updateNode($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']);
$oxidized_api->updateNode($hostname, $msg, $matches['user']);
} elseif (preg_match('/HWCM\/4\/CFGCHANGE/', $msg, $matches)) { //Huawei VRP devices CFGCHANGE syslog
oxidized_node_update($hostname, $msg);
$oxidized_api->updateNode($hostname, $msg);
} elseif (preg_match('/UI_COMMIT: User \\\\\'(?P<user>.+?)\\\\\' .*/', $msg, $matches)) {
oxidized_node_update($hostname, $msg, $matches['user']);
$oxidized_api->updateNode($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
$oxidized_api->updateNode($hostname, $msg, $matches['user']); //Alliedware Plus devices. Requires at least V5.4.8-2.1
} elseif (preg_match('/System configuration saved/', $msg, $matches)) {
oxidized_node_update($hostname, $msg); //ScreenOS
$oxidized_api->updateNode($hostname, $msg); //ScreenOS
} elseif (preg_match('/Running Config Change/', $msg, $matches)) {
oxidized_node_update($hostname, $msg); //HPE and Aruba Procurve devices
$oxidized_api->updateNode($hostname, $msg); //HPE and Aruba Procurve devices
}