add multi DB support to the Postgres app (#6222)

* now creates a component with all the DBs in it

* add the function get_postgres_databases

* add multi DB support to the Postgres device app page

* add multi DB support to the Postgres graphs

* whoops removed the udpate bit, readd it

* white space cleanup

* now use json for storing DB names

* provide the list of DBs in a cleaner manner

* Update postgres.inc.php
This commit is contained in:
VVelox
2017-04-12 04:45:12 -05:00
committed by Neil Lathwood
parent 4b0972628f
commit c222aa41a0
9 changed files with 183 additions and 6 deletions

View File

@ -1516,6 +1516,31 @@ function get_fail2ban_jails($device_id)
return array();
}
/**
* Get the Postgres databases for a device... just requires the device ID
* an empty return means Postres is not in use
* @param $device_id
* @return array
*/
function get_postgres_databases($device_id)
{
$options=array(
'filter' => array(
'type' => array('=', 'postgres'),
),
);
$component=new LibreNMS\Component();
$pgc=$component->getComponents($device_id, $options);
if (isset($pgc[$device_id])) {
$id = $component->getFirstComponentID($pgc, $device_id);
return json_decode($pgc[$device_id][$id]['databases']);
}
return array();
}
// takes the device array and app_id
function get_disks_with_smart($device, $app_id)
{