mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Remove nfs requirement for distributed poller (with rrdtool 1.5+)
Use data_update instead of rrd_update/rrd_create and influx_update Centralize rrd file check so we can check against a remote rrdcached server too Use rrd_name() to generate rrd file names
This commit is contained in:
@@ -9,130 +9,126 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
if (strstr($hardware, 'CMM') == false) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-errorCount.rrd";
|
||||
$fecInErrorsCount = snmp_get($device, "fecInErrorsCount.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB");
|
||||
$fecOutErrorsCount = snmp_get($device, "fecOutErrorsCount.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB");
|
||||
if (is_numeric($fecInErrorsCount) && is_numeric($fecOutErrorsCount)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:fecInErrorsCount:GAUGE:600:0:100000 DS:fecOutErrorsCount:GAUGE:600:0:100000".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:fecInErrorsCount:GAUGE:600:0:100000',
|
||||
'DS:fecOutErrorsCount:GAUGE:600:0:100000'
|
||||
);
|
||||
$fields = array(
|
||||
'fecInErrorsCount' => $fecInErrorsCount,
|
||||
'fecOutErrorsCount' => $fecOutErrorsCount,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-errorCount', $tags, $fields);
|
||||
$graphs['cambium_generic_errorCount'] = TRUE;
|
||||
unset($rrd_filename,$fecInErrorsCount,$fecOutErrorsCount);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-crcErrors.rrd";
|
||||
$crcErrors = snmp_get($device, "fecCRCError.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB");
|
||||
if (is_numeric($crcErrors)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:crcErrors:GAUGE:600:0:100000".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:crcErrors:GAUGE:600:0:100000';
|
||||
$fields = array(
|
||||
'crcErrors' => $crcErrors,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-crcErrors', $tags, $fields);
|
||||
$graphs['cambium_generic_crcErrors'] = TRUE;
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-signalHV.rrd";
|
||||
$vertical = str_replace('"',"",snmp_get($device, ".1.3.6.1.4.1.161.19.3.2.2.117.0", "-Ovqn", ""));
|
||||
$horizontal = str_replace('"',"",snmp_get($device, ".1.3.6.1.4.1.161.19.3.2.2.118.0", "-Ovqn", ""));
|
||||
$combined = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.21.0", "-Ovqn", "");
|
||||
if (is_numeric($vertical) && is_numeric($horizontal) && is_numeric($combined)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:vertical:GAUGE:600:-150:0 DS:horizontal:GAUGE:600:-150:0 DS:combined:GAUGE:600:-150:0".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:vertical:GAUGE:600:-150:0',
|
||||
'DS:horizontal:GAUGE:600:-150:0',
|
||||
'DS:combined:GAUGE:600:-150:0'
|
||||
);
|
||||
$fields = array(
|
||||
'vertical' => floatval($vertical),
|
||||
'horizontal' => floatval($horizontal),
|
||||
'combined' => $combined,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-signalHV', $tags, $fields);
|
||||
$graphs['cambium_generic_signalHV'] = TRUE;
|
||||
unset($rrd_filename,$vertical,$horizontal,$combined);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-rssi.rrd";
|
||||
$rssi = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.2.0", "-Ovqn", "");
|
||||
if (is_numeric($rssi)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:rssi:GAUGE:600:0:5000".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:rssi:GAUGE:600:0:5000';
|
||||
$fields = array(
|
||||
'rssi' => $rssi,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-rssi', $tags, $fields);
|
||||
$graphs['cambium_generic_rssi'] = TRUE;
|
||||
unset($rrd_filename,$rssi);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-jitter.rrd";
|
||||
$jitter = snmp_get($device, "jitter.0", "-Ovqn", "WHISP-SM-MIB");
|
||||
if (is_numeric($jitter)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:jitter:GAUGE:600:0:20".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:jitter:GAUGE:600:0:20';
|
||||
$fields = array(
|
||||
'jitter' => $jitter,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-jitter', $tags, $fields);
|
||||
$graphs['cambium_generic_jitter'] = TRUE;
|
||||
unset($rrd_filename,$jitter);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-450-slaveHV.rrd";
|
||||
$horizontal = str_replace('"',"",snmp_get($device, "radioDbmHorizontal.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
$vertical = str_replace('"',"",snmp_get($device, "radioDbmVertical.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
if (is_numeric($horizontal) && is_numeric($vertical)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:horizontal:GAUGE:600:-100:100 DS:vertical:GAUGE:600:-100:100".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:horizontal:GAUGE:600:-100:100',
|
||||
'DS:vertical:GAUGE:600:-100:100'
|
||||
);
|
||||
$fields = array(
|
||||
'horizontal' => $horizontal,
|
||||
'vertical' => $vertical,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-450-slaveHV', $tags, $fields);
|
||||
$graphs['cambium_generic_450_slaveHV'] = TRUE;
|
||||
unset($rrd_filename,$horizontal,$vertical);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-450-slaveSSR.rrd";
|
||||
$ssr = str_replace('"',"",snmp_get($device, "signalStrengthRatio.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
if (is_numeric($ssr)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:ssr:GAUGE:600:-150:150".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:ssr:GAUGE:600:-150:150';
|
||||
$fields = array(
|
||||
'ssr' => $ssr,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-450-slaveSSR', $tags, $fields);
|
||||
$graphs['cambium_generic_450_slaveSSR'] = TRUE;
|
||||
unset($rrd_filename,$ssr);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-450-slaveSNR.rrd";
|
||||
$horizontal = str_replace('"',"",snmp_get($device, "signalToNoiseRatioSMHorizontal.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
$vertical = str_replace('"',"",snmp_get($device, "signalToNoiseRatioSMVertical.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
if (is_numeric($horizontal) && is_numeric($vertical)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:horizontal:GAUGE:600:0:100 DS:vertical:GAUGE:600:0:100".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:horizontal:GAUGE:600:0:100',
|
||||
'DS:vertical:GAUGE:600:0:100'
|
||||
);
|
||||
$fields = array(
|
||||
'horizontal' => $horizontal,
|
||||
'vertical' => $vertical,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-450-slaveSNR', $tags, $fields);
|
||||
$graphs['cambium_generic_450_slaveSNR'] = TRUE;
|
||||
unset($rrd_filename,$horizontal,$vertical);
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware, 'CMM')) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-whispGPSStats.rrd";
|
||||
$gpsStatus = snmp_get($device, "whispGPSStats.0", "-Ovqn", "WHISP-APS-MIB");
|
||||
if ($gpsStatus == 'generatingSync') {
|
||||
$gpsStatus = 3;
|
||||
@@ -144,113 +140,114 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware,
|
||||
$gpsStatus = 1;
|
||||
}
|
||||
if (is_numeric($gpsStatus)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:whispGPSStats:GAUGE:600:0:4".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:whispGPSStats:GAUGE:600:0:4';
|
||||
$fields = array(
|
||||
'whispGPSStats' => $gpsStatus,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-whispGPSStats', $tags, $fields);
|
||||
$graphs['cambium_generic_whispGPSStats'] = TRUE;
|
||||
unset($rrd_filename,$gpsStatus);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-gpsStats.rrd";
|
||||
$visible = str_replace('"',"",snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.7.0", "-Ovqn", ""));
|
||||
$tracked = str_replace('"',"",snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.8.0", "-Ovqn", ""));
|
||||
if (is_numeric($visible) && is_numeric($tracked)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:visible:GAUGE:600:0:1000 DS:tracked:GAUGE:600:0:1000".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:visible:GAUGE:600:0:1000',
|
||||
'DS:tracked:GAUGE:600:0:1000'
|
||||
);
|
||||
$fields = array(
|
||||
'visible' => floatval($visible),
|
||||
'tracked' => floatval($tracked),
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-gpsStats', $tags, $fields);
|
||||
$graphs['cambium_generic_gpsStats'] = TRUE;
|
||||
unset($rrd_filename,$visible,$tracked);
|
||||
}
|
||||
}
|
||||
//PTP Equipment
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-450-powerlevel.rrd";
|
||||
$lastLevel = str_replace('"',"",snmp_get($device, "lastPowerLevel.2", "-Ovqn", "WHISP-APS-MIB"));
|
||||
if (is_numeric($lastLevel)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:last:GAUGE:600:-100:0".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:last:GAUGE:600:-100:0';
|
||||
$fields = array(
|
||||
'last' => $lastLevel,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-450-powerlevel', $tags, $fields);
|
||||
$graphs['cambium_generic_450_powerlevel'] = TRUE;
|
||||
unset($lastLevel);
|
||||
}
|
||||
|
||||
if (strstr($version, 'AP') == false) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-450-linkRadioDbm.rrd";
|
||||
$horizontal = str_replace('"',"",snmp_get($device, "linkRadioDbmHorizontal.2", "-Ovqn", "WHISP-APS-MIB"));
|
||||
$vertical = str_replace('"',"",snmp_get($device, "linkRadioDbmVertical.2", "-Ovqn", "WHISP-APS-MIB"));
|
||||
if (is_numeric($horizontal) && is_numeric($vertical)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:horizontal:GAUGE:600:-100:0 DS:vertical:GAUGE:600:-100:0".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:horizontal:GAUGE:600:-100:0',
|
||||
'DS:vertical:GAUGE:600:-100:0'
|
||||
);
|
||||
$fields = array(
|
||||
'horizontal' => $horizontal,
|
||||
'vertical' => $vertical,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-450-linkRadioDbm', $tags, $fields);
|
||||
$graphs['cambium_generic_450_linkRadioDbm'] = TRUE;
|
||||
unset($rrd_filename,$horizontal,$horizontal);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-450-ptpSNR.rrd";
|
||||
$horizontal = str_replace('"',"",snmp_get($device, "signalToNoiseRatioHorizontal.2", "-Ovqn", "WHISP-APS-MIB"));
|
||||
$vertical = str_replace('"',"",snmp_get($device, "signalToNoiseRatioVertical.2", "-Ovqn", "WHISP-APS-MIB"));
|
||||
if (is_numeric($horizontal) && is_numeric($vertical)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:horizontal:GAUGE:600:0:100 DS:vertical:GAUGE:600:0:100".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:horizontal:GAUGE:600:0:100',
|
||||
'DS:vertical:GAUGE:600:0:100'
|
||||
);
|
||||
$fields = array(
|
||||
'horizontal' => $horizontal,
|
||||
'vertical' => $vertical,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-450-ptpSNR', $tags, $fields);
|
||||
$graphs['cambium_generic_450_ptpSNR'] = TRUE;
|
||||
unset($rrd_filename,$horizontal,$horizontal);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-450-masterSSR.rrd";
|
||||
$ssr = str_replace('"',"",snmp_get($device, "linkSignalStrengthRatio.2", "-Ovqn", "WHISP-APS-MIB"));
|
||||
if (is_numeric($ssr)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:ssr:GAUGE:600:-150:150".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:ssr:GAUGE:600:-150:150';
|
||||
$fields = array(
|
||||
'ssr' => $ssr,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-450-masterSSR', $tags, $fields);
|
||||
$graphs['cambium_generic_450_masterSSR'] = TRUE;
|
||||
unset($rrd_filename,$ssr);
|
||||
}
|
||||
|
||||
if (strstr($hardware, 'PTP 230')) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-radioDbm.rrd";
|
||||
$dbmRadio = str_replace('"',"",snmp_get($device, "radioDbmInt.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
$minRadio = str_replace('"',"",snmp_get($device, "minRadioDbm.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
$maxRadio = str_replace('"',"",snmp_get($device, "maxRadioDbm.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
$avgRadio = str_replace('"',"",snmp_get($device, "radioDbmAvg.0", "-Ovqn", "WHISP-SM-MIB"));
|
||||
|
||||
if (is_numeric($dbmRadio) && is_numeric($minRadio) && is_numeric($maxRadio) && is_numeric($avgRadio)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:dbm:GAUGE:600:-100:0 DS:min:GAUGE:600:-100:0 DS:max:GAUGE:600:-100:0 DS:avg:GAUGE:600:-100:0".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:dbm:GAUGE:600:-100:0',
|
||||
'DS:min:GAUGE:600:-100:0',
|
||||
'DS:max:GAUGE:600:-100:0',
|
||||
'DS:avg:GAUGE:600:-100:0'
|
||||
);
|
||||
$fields = array(
|
||||
'dbm' => $dbmRadio,
|
||||
'min' => $minRadio,
|
||||
'max' => $maxRadio,
|
||||
'avg' => $avgRadio,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-radioDbm', $tags, $fields);
|
||||
$graphs['cambium_generic_radioDbm'] = TRUE;
|
||||
unset($rrd_filename,$dbmRadio,$minRadio,$maxRadio,$avgRadio);
|
||||
}
|
||||
@@ -259,28 +256,26 @@ if (strstr($version, 'AP') == false) {
|
||||
|
||||
//AP Equipment
|
||||
if (strstr($version, 'AP')) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-regCount.rrd";
|
||||
$registered = str_replace('"',"",snmp_get($device, "regCount.0", "-Ovqn", "WHISP-APS-MIB"));
|
||||
$failed = str_replace('"',"",snmp_get($device, "regFailureCount.0", "-Ovqn", "WHISP-APS-MIB"));
|
||||
if (is_numeric($registered) && is_numeric($failed)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:regCount:GAUGE:600:0:15000 DS:failed:GAUGE:600:0:15000".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = array(
|
||||
'DS:regCount:GAUGE:600:0:15000',
|
||||
'DS:failed:GAUGE:600:0:15000'
|
||||
);
|
||||
$fields = array(
|
||||
'regCount' => $registered,
|
||||
'failed' => $failed,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-regCount', $tags, $fields);
|
||||
$graphs['cambium_generic_regCount'] = TRUE;
|
||||
unset($rrd_filename,$registered,$failed);
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cambium-generic-freq.rrd";
|
||||
$freq = str_replace('"',"",snmp_get($device, "currentRadioFreqCarrier.0", "-Ovqn", "WHISP-APS-MIB"));
|
||||
if (is_numeric($freq)) {
|
||||
if (!is_file($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, " --step 300 DS:freq:GAUGE:600:0:100000".$config['rrd_rra']);
|
||||
}
|
||||
$rrd_def = 'DS:freq:GAUGE:600:0:100000';
|
||||
if ($freq > 99999) {
|
||||
$freq = $freq / 100000;
|
||||
}
|
||||
@@ -290,7 +285,8 @@ if (strstr($version, 'AP')) {
|
||||
$fields = array(
|
||||
'freq' => $freq,
|
||||
);
|
||||
rrdtool_update($rrd_filename, $fields);
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cambium-generic-freq', $tags, $fields);
|
||||
$graphs['cambium_generic_freq'] = TRUE;
|
||||
unset($rrd_filename,$freq);
|
||||
}
|
||||
|
Reference in New Issue
Block a user