mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Optimize OSPF poller (#9080)
if there are no instances, don't check for areas, neighbors, and ports 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`
This commit is contained in:
committed by
Neil Lathwood
parent
d46f300260
commit
05a77b7bd2
@@ -42,7 +42,12 @@ foreach ($vrfs_lite_cisco as $vrf_lite) {
|
||||
->where(['device_id' => $device['device_id'], 'context_name' => $device['context_name']])
|
||||
->whereNotIn('id', $ospf_instances->pluck('id'))->delete();
|
||||
|
||||
echo $ospf_instances->count();
|
||||
$instance_count = $ospf_instances->count();
|
||||
echo $instance_count;
|
||||
if ($instance_count == 0) {
|
||||
// if there are no instances, don't check for areas, neighbors, and ports
|
||||
return;
|
||||
}
|
||||
|
||||
echo ' Areas: ';
|
||||
|
||||
@@ -145,7 +150,7 @@ $rrd_def = RrdDefinition::make()
|
||||
->addDataset('neighbours', 'GAUGE', 0, 1000000);
|
||||
|
||||
$fields = [
|
||||
'instances' => $ospf_instances->count(),
|
||||
'instances' => $instance_count,
|
||||
'areas' => $ospf_areas->count(),
|
||||
'ports' => $ospf_ports->count(),
|
||||
'neighbours' => $ospf_neighbours->count(),
|
||||
@@ -158,6 +163,7 @@ echo PHP_EOL;
|
||||
|
||||
unset(
|
||||
$ospf_instances,
|
||||
$instance_count,
|
||||
$ospf_areas,
|
||||
$ospf_ports,
|
||||
$ospf_neighbours,
|
||||
|
||||
Reference in New Issue
Block a user