mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add Suricata monitoring (#13942)
* add poller * add a generic alert graph * add support for .total * add the initial work on the suricata app page * add applayer flow sources * more rrd work and add more fields * add a missing graph to the suricata page * add suricata to the apps page * all working now for suricata * add some suricata alert examples * all done with the php * update the application docs for Suricata * add another note about Suricata stats in the docs * add the test file * add the test JSON * remove a unneeded newline from the appication docs * correct the type uptime type * packets graph should by packets/sec * minor formatting cleanup * one more minor formatting cleanup * shot in the dark to see if something fixes the angry linter * fix snmpsim file * add metrics * add values to the metrics * add a missing comma to the json * add a missing line to snmprec and cleanup json a bit * a few more minor changes to see if this makes it happy... regened via scripts/json-app-tool.php * see if this will make it happy * add suricata to app discovery and hope that fixes it... take a shot in the dark as to why the linter errors strangely on two of the files * fix json * add a missing ] to the json * rename two graphs so it does not trigger one alert and add a missing metric * whoops, *_alertString is not a metric
This commit is contained in:
@@ -1324,6 +1324,33 @@ function get_sensor_label_color($sensor, $type = 'sensors')
|
||||
return "<span class='label $label_style'>" . trim(Number::formatSi($sensor['sensor_current'], 2, 3, $unit)) . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of the various suricata instances for
|
||||
* the specified device id.
|
||||
*
|
||||
* @param $device_id
|
||||
* @return array
|
||||
*/
|
||||
function get_suricata_instances($device_id)
|
||||
{
|
||||
$options = [
|
||||
'filter' => [
|
||||
'type' => ['=', 'suricata'],
|
||||
],
|
||||
];
|
||||
|
||||
$component = new LibreNMS\Component();
|
||||
$ourc = $component->getComponents($device_id, $options);
|
||||
|
||||
if (isset($ourc[$device_id])) {
|
||||
$id = $component->getFirstComponentID($ourc, $device_id);
|
||||
|
||||
return json_decode($ourc[$device_id][$id]['instances']);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @params int unix time
|
||||
* @params int seconds
|
||||
|
||||
Reference in New Issue
Block a user