mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user