Migrate addhost.php to lnms device:add (#13870)

* Migrate addhost.php to lnms device:add
Have snmp-scan.py call lnms device:add (make exit codes line up so this works)
Fix issue with ping only devices trying to detect os via snmp
Reorder options in device:add help and improve formatting
Update docs to remove references to addhost.php
Fix a bit of code that was in functional code

* fixes

* fix snmp version message
This commit is contained in:
Tony Murray
2022-04-04 10:41:18 -05:00
committed by GitHub
parent 96b708a10e
commit 75ba74fe5b
13 changed files with 167 additions and 187 deletions

View File

@@ -31,6 +31,7 @@ use LibreNMS\Config;
use LibreNMS\Interfaces\Module;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
use LibreNMS\Util\Compare;
use LibreNMS\Util\Time;
use Log;
use SnmpQuery;
@@ -201,7 +202,7 @@ class Core implements Module
->mibDir($value['mib_dir'] ?? $mibdir)
->get(isset($value['mib']) ? "{$value['mib']}::{$value['oid']}" : $value['oid'])
->value();
if (compare_var($get_value, $value['value'], $value['op'] ?? 'contains') == $check) {
if (Compare::values($get_value, $value['value'], $value['op'] ?? 'contains') == $check) {
return false;
}
} elseif ($key == 'snmpwalk') {
@@ -210,7 +211,7 @@ class Core implements Module
->mibDir($value['mib_dir'] ?? $mibdir)
->walk(isset($value['mib']) ? "{$value['mib']}::{$value['oid']}" : $value['oid'])
->raw();
if (compare_var($walk_value, $value['value'], $value['op'] ?? 'contains') == $check) {
if (Compare::values($walk_value, $value['value'], $value['op'] ?? 'contains') == $check) {
return false;
}
}