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:
VVelox
2017-03-29 22:54:02 -05:00
committed by Tony Murray
parent 3ac4e3c8d5
commit acd11955d2
4 changed files with 94 additions and 15 deletions

View File

@@ -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)
{