Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,26 +6,35 @@
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
if (is_numeric($vars['id']))
{
//$sensor = dbFetchRow("SELECT * FROM `sensors` WHERE `sensor_id` = ?", array($vars['id']));
$sensor = get_entity_by_id_cache('sensor', $vars['id']);
if (!is_intnum($vars['id'])) {
return;
}
if (is_numeric($sensor['device_id']) && ($auth || is_entity_permitted($sensor['sensor_id'], 'sensor') || device_permitted($sensor['device_id'])))
{
$sensor = get_entity_by_id_cache('sensor', $vars['id']);
if (is_numeric($sensor['device_id']) && ($auth || is_entity_permitted($sensor['sensor_id'], 'sensor') || device_permitted($sensor['device_id']))) {
$device = device_by_id_cache($sensor['device_id']);
$rrd_filename = get_rrd_path($device, get_sensor_rrd($device, $sensor));
$title = generate_device_link($device);
$title .= " :: Sensors :: ";
$auth = TRUE;
}
$auth = TRUE;
$title_array = [];
$title_array[] = [ 'text' => $device['hostname'],
'url' => generate_url([ 'page' => 'device', 'device' => $device['device_id'] ]) ];
$title_array[] = [ 'text' => 'Sensors ('.nicecase($sensor['sensor_class']).')',
'url' => generate_url([ 'page' => 'device', 'device' => $device['device_id'], 'tab' => 'health', 'metric' => $sensor['sensor_class'] ]) ];
$title_array[] = [ 'text' => escape_html($sensor['status_descr']),
'url' => generate_url([ 'page' => 'device', 'device' => $device['device_id'], 'tab' => 'health', 'metric' => $sensor['sensor_class'], 'sensor_id' => $vars['id'] ]) ];
$graph_title = device_name($device, TRUE);
$graph_title .= " :: Sensor :: " . $sensor['sensor_descr'];
}
// EOF

View File

@ -6,25 +6,35 @@
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Some Class specific options
switch ($sensor['sensor_class']) {
case 'humidity':
case 'capacity':
case 'load':
case 'progress':
$scale_min = "0";
$scale_max = "100";
break;
case 'snr':
case 'attenuation':
case 'sound':
$scale_min = "0";
$scale_max = "60";
break;
case 'humidity':
case 'capacity':
case 'load':
case 'progress':
$scale_min = "0";
$scale_max = "100";
break;
case 'power':
$autoscale = 'default';
break;
case 'snr':
case 'attenuation':
case 'sound':
$scale_min = "0";
$scale_max = "60";
break;
case 'waterflow':
$alt_y = FALSE; // Disable alternative Y grid for waterflow
default:
$scale_rigid = FALSE;
}
$ds = "sensor";
@ -33,25 +43,25 @@ $sensor_type = $config['sensor_types'][$sensor['sensor_type']];
$line_text = $sensor['sensor_descr'];
$colour_line = "cc0000";
$colour_area = "FFBBBB";
$colour_line = "cc0000";
$colour_area = "FFBBBB";
$colour_minmax = "c5c5c5";
$graph_max = 1;
//$graph_max = 1;
if (isset($sensor_type['graph_unit'])) {
$unit_text = $sensor_type['graph_unit'];
$unit_text = $sensor_type['graph_unit'];
} else {
$unit_text = $sensor_type['symbol'];
$unit_text = $sensor_type['symbol'];
}
$print_min = 1;
include($config['html_dir']."/includes/graphs/generic_simplex.inc.php");
include($config['html_dir'] . "/includes/graphs/generic_simplex.inc.php");
if (is_numeric($sensor['sensor_limit'])) {
$rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes";
$rrd_options .= " HRULE:" . $sensor['sensor_limit'] . "#999999::dashes";
}
if (is_numeric($sensor['sensor_limit_low'])) {
$rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes";
$rrd_options .= " HRULE:" . $sensor['sensor_limit_low'] . "#999999::dashes";
}
$graph_return['descr'] = $sensor_type['descr'];