Don't update ospf stats if there are none. (#9133)

Also fixes fatal error ->count() on null.
This commit is contained in:
Tony Murray
2018-09-02 17:42:50 -05:00
committed by Neil Lathwood
parent 30790bafd1
commit 0f0ae34d77

View File

@@ -142,6 +142,7 @@ foreach ($vrfs_lite_cisco as $vrf_lite) {
unset($device['context_name'], $vrfs_lite_cisco, $vrf_lite); unset($device['context_name'], $vrfs_lite_cisco, $vrf_lite);
if ($instance_count) {
// Create device-wide statistics RRD // Create device-wide statistics RRD
$rrd_def = RrdDefinition::make() $rrd_def = RrdDefinition::make()
->addDataset('instances', 'GAUGE', 0, 1000000) ->addDataset('instances', 'GAUGE', 0, 1000000)
@@ -158,6 +159,7 @@ $fields = [
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'ospf-statistics', $tags, $fields); data_update($device, 'ospf-statistics', $tags, $fields);
}
echo PHP_EOL; echo PHP_EOL;