mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Force lower case (#12178)
We force the strings returned from the "unbound-control stats" command to "lower case", avoiding problems with future changes to the unbound output in other variables. All code must contain lower case letters in the $ unbound [] variable
This commit is contained in:
committed by
GitHub
parent
863fb96205
commit
5b892dc4f8
@ -17,7 +17,7 @@ $unbound = [];
|
|||||||
$metrics = [];
|
$metrics = [];
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
[$var,$value] = explode('=', $line);
|
[$var,$value] = explode('=', $line);
|
||||||
$unbound[$var] = $value;
|
$unbound[strtolower($var)] = $value;
|
||||||
}
|
}
|
||||||
//Unbound Queries
|
//Unbound Queries
|
||||||
$rrd_name = ['app', $name, 'queries', $app_id];
|
$rrd_name = ['app', $name, 'queries', $app_id];
|
||||||
@ -41,23 +41,23 @@ $rrd_def = RrdDefinition::make()
|
|||||||
->addDataset('ANY', 'DERIVE', 0, 125000000000)
|
->addDataset('ANY', 'DERIVE', 0, 125000000000)
|
||||||
->addDataset('other', 'DERIVE', 0, 125000000000);
|
->addDataset('other', 'DERIVE', 0, 125000000000);
|
||||||
$fields = [
|
$fields = [
|
||||||
'type0' => $unbound['num.query.type.TYPE0'],
|
'type0' => $unbound['num.query.type.type0'],
|
||||||
'A' => $unbound['num.query.type.A'],
|
'A' => $unbound['num.query.type.a'],
|
||||||
'NS' => $unbound['num.query.type.NS'],
|
'NS' => $unbound['num.query.type.ns'],
|
||||||
'CNAME' => $unbound['num.query.type.CNAME'],
|
'CNAME' => $unbound['num.query.type.cname'],
|
||||||
'SOA' => $unbound['num.query.type.SOA'],
|
'SOA' => $unbound['num.query.type.soa'],
|
||||||
'NULL' => $unbound['num.query.type.NULL'],
|
'NULL' => $unbound['num.query.type.null'],
|
||||||
'WKS' => $unbound['num.query.type.WKS'],
|
'WKS' => $unbound['num.query.type.wks'],
|
||||||
'PTR' => $unbound['num.query.type.PTR'],
|
'PTR' => $unbound['num.query.type.ptr'],
|
||||||
'MX' => $unbound['num.query.type.MX'],
|
'MX' => $unbound['num.query.type.mx'],
|
||||||
'TXT' => $unbound['num.query.type.TXT'],
|
'TXT' => $unbound['num.query.type.txt'],
|
||||||
'AAAA' => $unbound['num.query.type.AAAA'],
|
'AAAA' => $unbound['num.query.type.aaaa'],
|
||||||
'SRV' => $unbound['num.query.type.SRV'],
|
'SRV' => $unbound['num.query.type.src'],
|
||||||
'NAPTR' => $unbound['num.query.type.NAPTR'],
|
'NAPTR' => $unbound['num.query.type.naptr'],
|
||||||
'DS' => $unbound['num.query.type.DS'],
|
'DS' => $unbound['num.query.type.ds'],
|
||||||
'DNSKEY' => $unbound['num.query.type.DNSKEY'],
|
'DNSKEY' => $unbound['num.query.type.dnskey'],
|
||||||
'SPF' => $unbound['num.query.type.SPF'],
|
'SPF' => $unbound['num.query.type.spf'],
|
||||||
'ANY' => $unbound['num.query.type.ANY'],
|
'ANY' => $unbound['num.query.type.any'],
|
||||||
'other' => $unbound['num.query.type.other'],
|
'other' => $unbound['num.query.type.other'],
|
||||||
];
|
];
|
||||||
$metrics['queries'] = $fields;
|
$metrics['queries'] = $fields;
|
||||||
@ -85,9 +85,9 @@ $rrd_def = RrdDefinition::make()
|
|||||||
->addDataset('rcodeNXDOMAIN', 'DERIVE', 0, 125000000000)
|
->addDataset('rcodeNXDOMAIN', 'DERIVE', 0, 125000000000)
|
||||||
->addDataset('rcodeNodata', 'DERIVE', 0, 125000000000);
|
->addDataset('rcodeNodata', 'DERIVE', 0, 125000000000);
|
||||||
$fields = [
|
$fields = [
|
||||||
'opcodeQuery' => $unbound['num.query.opcode.QUERY'],
|
'opcodeQuery' => $unbound['num.query.opcode.query'],
|
||||||
'rcodeNOERROR' => $unbound['num.answer.rcode.NOERROR'],
|
'rcodeNOERROR' => $unbound['num.answer.rcode.noerror'],
|
||||||
'rcodeNXDOMAIN' => $unbound['num.answer.rcode.NXDOMAIN'],
|
'rcodeNXDOMAIN' => $unbound['num.answer.rcode.nxdomain'],
|
||||||
'rcodeNodata' => $unbound['num.answer.rcode.nodata'],
|
'rcodeNodata' => $unbound['num.answer.rcode.nodata'],
|
||||||
];
|
];
|
||||||
$metrics['operations'] = $fields;
|
$metrics['operations'] = $fields;
|
||||||
|
Reference in New Issue
Block a user