Files
librenms-librenms/includes/html/pages/device/apps/postgres.inc.php

69 lines
1.6 KiB
PHP
Raw Normal View History

2017-03-06 16:58:13 -06:00
<?php
2020-09-21 15:40:17 +02:00
$databases = get_postgres_databases($device['device_id']);
2020-09-21 15:40:17 +02:00
$link_array = [
'page' => 'device',
'device' => $device['device_id'],
'tab' => 'apps',
'app' => 'postgres',
2020-09-21 15:40:17 +02:00
];
print_optionbar_start();
echo generate_link('Total', $link_array);
echo '| DBs:';
2020-09-21 15:40:17 +02:00
$db_int = 0;
while (isset($databases[$db_int])) {
2020-09-21 15:40:17 +02:00
$db = $databases[$db_int];
$label = $db;
if ($vars['database'] == $db) {
2020-09-21 15:40:17 +02:00
$label = '>>' . $db . '<<';
}
$db_int++;
2020-09-21 15:40:17 +02:00
$append = '';
if (isset($databases[$db_int])) {
2020-09-21 15:40:17 +02:00
$append = ', ';
}
2020-09-21 15:40:17 +02:00
echo generate_link($label, $link_array, ['database'=>$db]) . $append;
}
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',
'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';
$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
if (isset($vars['database'])) {
2020-09-21 15:40:17 +02:00
$graph_array['database'] = $vars['database'];
}
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">';
include 'includes/html/print-graphrow.inc.php';
2017-03-06 16:58:13 -06:00
echo '</div>';
echo '</div>';
echo '</div>';
}