Tony Murray fad0bffc43 Escape SNMP & IPMI shell commands (#9537)
hopefully doesn't break anything
Mostly issues with snmp oids and options containing spaces.  Try to remove all of those.

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 <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`.  If there are schema changes, you can ask on discord how to revert.
2018-12-16 13:42:50 +00:00

27 lines
1018 B
PHP

<?php
use LibreNMS\RRD\RrdDefinition;
$temp_data = snmp_get_multi_oid($device, ['fnSysSerial.0', 'fmSysVersion.0', 'fmDeviceEntMode.1'], '-OUQs', 'FORTINET-CORE-MIB:FORTINET-FORTIMANAGER-FORTIANALYZER-MIB');
$serial = $temp_data['fnSysSerial.0'];
$version = $temp_data['fmSysVersion.0'];
$hardware = rewrite_fortinet_hardware($device['sysObjectID']);
if ($hardware == $device['sysObjectID']) {
unset($hardware);
}
//Log rate only for FortiAnalyzer features enabled FortiManagers
if ($temp_data['fmDeviceEntMode.1'] == 'fmg-faz') {
$features = 'with Analyzer features';
$log_rate = snmp_get($device, '.1.3.6.1.4.1.12356.103.2.1.9.0', '-Ovq');
$log_rate = str_replace(' logs per second', '', $log_rate);
$rrd_def = RrdDefinition::make()->addDataset('lograte', 'GAUGE', 0, 100000000);
$fields = array(
'lograte' => $log_rate,
);
$tags = compact('rrd_def');
data_update($device, 'fortios_lograte', $tags, $fields);
$graphs['fortios_lograte'] = true;
}
unset($temp_data);