mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 08:01:38 +02:00
This should process all of the messages on these sites and if it fails, there should be no data loss
http://www.cisco.com/c/en/us/support/docs/switches/catalyst-6000-series-switches/29804-186.html http://www.cisco.com/c/en/us/td/docs/ios/system/messages/guide/consol_smg/sm_cnovr.html
This commit is contained in:
+17
-8
@@ -52,18 +52,27 @@ function process_syslog($entry, $update) {
|
|||||||
$os = get_cache($entry['host'], 'os');
|
$os = get_cache($entry['host'], 'os');
|
||||||
|
|
||||||
if (in_array($os, array('ios', 'iosxe', 'catos'))) {
|
if (in_array($os, array('ios', 'iosxe', 'catos'))) {
|
||||||
$matches = array();
|
// multipart message
|
||||||
/* Split the following examples, or fallback to leaving everything in msg
|
if(strpos($entry['msg'], ':') !== false) {
|
||||||
* %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to up
|
/* Split the following examples
|
||||||
* %SYS-5-MOD_OK:Module 1 is online
|
* %CARD-SEVERITY-MSG:SLOT %FACILITY-SEVERITY-MNEMONIC: Message-text
|
||||||
|
* %FACILITY-SUBFACILITY-SEVERITY-MNEMONIC: Message-text
|
||||||
*/
|
*/
|
||||||
if (preg_match('/^%([A-Z\d\-_]+): ?(.+)/', $entry['msg'], $matches)) {
|
$matches = array();
|
||||||
$entry['program'] = $matches[1];
|
if(preg_match('/^%?(?<program>[A-Za-z\d\-_]+(:[A-Z]* %[A-Z\d\-_]+)?): ?(?<msg>.*)/', $entry['msg'], $matches)) {
|
||||||
$entry['msg'] = $matches[2];
|
$entry['program'] = $matches['program'];
|
||||||
|
$entry['msg'] = $matches['msg'];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($matches);
|
unset($matches);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// if this looks like a program (no groups of 2 or more lowercase letters), move it to program
|
||||||
|
if (preg_match('/[^(a-z)]{2,}/', $entry['msg'])) {
|
||||||
|
$entry['program'] = $entry['msg'];
|
||||||
|
unset($entry['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ($os == 'linux' and get_cache($entry['host'], 'version') == 'Point') {
|
else if ($os == 'linux' and get_cache($entry['host'], 'version') == 'Point') {
|
||||||
// Cisco WAP200 and similar
|
// Cisco WAP200 and similar
|
||||||
$matches = array();
|
$matches = array();
|
||||||
|
|||||||
Reference in New Issue
Block a user