mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
use components for fail2ban jails list (#6221)
* add get_fail2ban_jails functions * now do component stuff for fail2ban for tracking jails * now use get_fail2ban_jails for getting a list of jails * readd the accidentally deleted update app bit * white space cleanup * Update fail2ban component code * remove unneeded variable
This commit is contained in:
@@ -1490,6 +1490,31 @@ function get_disks($device)
|
||||
return dbFetchRows('SELECT * FROM `ucd_diskio` WHERE device_id = ? ORDER BY diskio_descr', array($device));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fail2ban jails for a device... just requires the device ID
|
||||
* an empty return means either no jails or fail2ban is not in use
|
||||
* @param $device_id
|
||||
* @return array
|
||||
*/
|
||||
function get_fail2ban_jails($device_id)
|
||||
{
|
||||
$options=array(
|
||||
'filter' => array(
|
||||
'type' => array('=', 'fail2ban'),
|
||||
),
|
||||
);
|
||||
|
||||
$component=new LibreNMS\Component();
|
||||
$f2bc=$component->getComponents($device_id, $options);
|
||||
|
||||
if (isset($f2bc[$device_id])) {
|
||||
$id = $component->getFirstComponentID($f2bc, $device_id);
|
||||
return json_decode($f2bc[$device_id][$id]['jails']);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
// takes the device array and app_id
|
||||
function get_disks_with_smart($device, $app_id)
|
||||
{
|
||||
|
Reference in New Issue
Block a user