2017-03-06 16:58:13 -06:00
|
|
|
<?php
|
|
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
$databases = get_postgres_databases($device['device_id']);
|
2017-04-12 04:45:12 -05:00
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
$link_array = [
|
2017-04-12 04:45:12 -05:00
|
|
|
'page' => 'device',
|
|
|
|
|
'device' => $device['device_id'],
|
|
|
|
|
'tab' => 'apps',
|
|
|
|
|
'app' => 'postgres',
|
2020-09-21 15:40:17 +02:00
|
|
|
];
|
2017-04-12 04:45:12 -05:00
|
|
|
|
|
|
|
|
print_optionbar_start();
|
|
|
|
|
|
|
|
|
|
echo generate_link('Total', $link_array);
|
|
|
|
|
echo '| DBs:';
|
2020-09-21 15:40:17 +02:00
|
|
|
$db_int = 0;
|
2017-04-12 04:45:12 -05:00
|
|
|
while (isset($databases[$db_int])) {
|
2020-09-21 15:40:17 +02:00
|
|
|
$db = $databases[$db_int];
|
|
|
|
|
$label = $db;
|
2017-04-12 04:45:12 -05:00
|
|
|
|
|
|
|
|
if ($vars['database'] == $db) {
|
2020-09-21 15:40:17 +02:00
|
|
|
$label = '>>' . $db . '<<';
|
2017-04-12 04:45:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$db_int++;
|
|
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
$append = '';
|
2017-04-12 04:45:12 -05:00
|
|
|
if (isset($databases[$db_int])) {
|
2020-09-21 15:40:17 +02:00
|
|
|
$append = ', ';
|
2017-04-12 04:45:12 -05:00
|
|
|
}
|
|
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
echo generate_link($label, $link_array, ['database'=>$db]) . $append;
|
2017-04-12 04:45:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print_optionbar_end();
|
|
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
$graphs = [
|
2017-03-06 16:58:13 -06:00
|
|
|
'postgres_backends' => 'Backends',
|
|
|
|
|
'postgres_cr' => 'Commits & Rollbacks',
|
|
|
|
|
'postgres_rows' => 'Rows',
|
|
|
|
|
'postgres_hr' => 'Buffer Hits & Disk Blocks Read',
|
2018-09-05 22:16:13 -04:00
|
|
|
'postgres_index' => 'Indexes',
|
2017-03-06 16:58:13 -06:00
|
|
|
'postgres_sequential' => 'Sequential',
|
2020-09-21 15:40:17 +02:00
|
|
|
];
|
2017-03-06 16:58:13 -06:00
|
|
|
|
|
|
|
|
foreach ($graphs as $key => $text) {
|
2020-09-21 15:40:17 +02:00
|
|
|
$graph_type = $key;
|
2017-03-06 16:58:13 -06:00
|
|
|
$graph_array['height'] = '100';
|
2020-09-21 15:40:17 +02:00
|
|
|
$graph_array['width'] = '215';
|
2019-06-23 00:29:12 -05:00
|
|
|
$graph_array['to'] = \LibreNMS\Config::get('time.now');
|
2020-09-21 15:40:17 +02:00
|
|
|
$graph_array['id'] = $app['app_id'];
|
|
|
|
|
$graph_array['type'] = 'application_' . $key;
|
2017-03-06 16:58:13 -06:00
|
|
|
|
2017-04-12 04:45:12 -05:00
|
|
|
if (isset($vars['database'])) {
|
2020-09-21 15:40:17 +02:00
|
|
|
$graph_array['database'] = $vars['database'];
|
2017-04-12 04:45:12 -05:00
|
|
|
}
|
|
|
|
|
|
2017-03-06 16:58:13 -06:00
|
|
|
echo '<div class="panel panel-default">
|
|
|
|
|
<div class="panel-heading">
|
2020-09-21 15:40:17 +02:00
|
|
|
<h3 class="panel-title">' . $text . '</h3>
|
2017-03-06 16:58:13 -06:00
|
|
|
</div>
|
|
|
|
|
<div class="panel-body">
|
|
|
|
|
<div class="row">';
|
2019-04-11 23:26:42 -05:00
|
|
|
include 'includes/html/print-graphrow.inc.php';
|
2017-03-06 16:58:13 -06:00
|
|
|
echo '</div>';
|
|
|
|
|
echo '</div>';
|
|
|
|
|
echo '</div>';
|
|
|
|
|
}
|