commit version 22.12.12447
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,68 +6,63 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
global $agent_sensors;
|
||||
|
||||
if ($agent_data['nvidia']['smi'] != '')
|
||||
{
|
||||
if (!safe_empty($agent_data['nvidia']['smi'])) {
|
||||
|
||||
$invalid = [ '[Not Supported]', 'N/A', '[N/A]' ];
|
||||
$nvidia = parse_csv($agent_data['nvidia']['smi']);
|
||||
if (count($nvidia))
|
||||
{
|
||||
if (safe_count($nvidia)) {
|
||||
|
||||
print_cli_heading("nvidia-smi", 3);
|
||||
foreach ($nvidia as $card)
|
||||
{
|
||||
foreach ($nvidia as $card) {
|
||||
|
||||
$descr_card = "Nvidia Card ".($card['index']+1).": ".$card['name'];
|
||||
print_cli_heading($descr_card, 4);
|
||||
|
||||
if (!in_array($card['temperature.gpu'], ['[Not Supported]', 'N/A', '[N/A]']))
|
||||
{
|
||||
if (!in_array($card['temperature.gpu'], $invalid)) {
|
||||
$index = 'temperature.gpu.'.$card['index'];
|
||||
$descr = $descr_card;
|
||||
discover_sensor('temperature', $device, '', $index, 'nvidia-smi', $descr, 1, $card['temperature.gpu'], ['limit_high' => 100], 'agent');
|
||||
$agent_sensors['temperature']['nvidia-smi'][$index] = array('description' => $descr, 'current' => $card['temperature.gpu'], 'index' => $index);
|
||||
discover_sensor('temperature', $device, '', $index, 'nvidia-smi', $descr, 1, $card['temperature.gpu'], [ 'limit_high' => 100 ], 'agent');
|
||||
$agent_sensors['temperature']['nvidia-smi'][$index] = [ 'description' => $descr, 'current' => $card['temperature.gpu'], 'index' => $index ];
|
||||
print_cli_data("temperature.gpu", $card['temperature.gpu']."C");
|
||||
|
||||
}
|
||||
|
||||
if (!in_array($card['power.draw [W]'], ['[Not Supported]', 'N/A', '[N/A]']))
|
||||
{
|
||||
if (!in_array($card['power.draw [W]'], $invalid)) {
|
||||
$index = 'power.draw.'.$card['index'];
|
||||
$descr = $descr_card;
|
||||
discover_sensor('power', $device, '', $index, 'nvidia-smi', $descr, 1, $card['power.draw [W]'], array(), 'agent');
|
||||
$agent_sensors['power']['nvidia-smi'][$index] = array('description' => $descr, 'current' => $card['power.draw [W]'], 'index' => $index);
|
||||
discover_sensor('power', $device, '', $index, 'nvidia-smi', $descr, 1, $card['power.draw [W]'], [], 'agent');
|
||||
$agent_sensors['power']['nvidia-smi'][$index] = [ 'description' => $descr, 'current' => $card['power.draw [W]'], 'index' => $index ];
|
||||
print_cli_data("power.draw", $card['power.draw [W]']."W");
|
||||
}
|
||||
|
||||
if (!in_array($card['fan.speed [%]'], ['[Not Supported]', 'N/A', '[N/A]']))
|
||||
{
|
||||
if (!in_array($card['fan.speed [%]'], $invalid)) {
|
||||
$index = 'fan.speed.'.$card['index'];
|
||||
$descr = $descr_card . " Fan Load";
|
||||
discover_sensor('load', $device, '', $index, 'nvidia-smi', $descr, 1, $card['fan.speed [%]'], ['limit_high' => 100, 'limit_low' => 0], 'agent');
|
||||
$agent_sensors['load']['nvidia-smi'][$index] = array('description' => $descr, 'current' => $card['fan.speed [%]'], 'index' => $index);
|
||||
discover_sensor('load', $device, '', $index, 'nvidia-smi', $descr, 1, $card['fan.speed [%]'], [ 'limit_high' => 100, 'limit_low' => 0 ], 'agent');
|
||||
$agent_sensors['load']['nvidia-smi'][$index] = [ 'description' => $descr, 'current' => $card['fan.speed [%]'], 'index' => $index ];
|
||||
print_cli_data("fan.speed", $card['fan.speed [%]']."");
|
||||
}
|
||||
|
||||
if (!in_array($card['utilisation.gpu [%]'], ['[Not Supported]', 'N/A', '[N/A]']))
|
||||
{
|
||||
$index = 'utilisation.gpu.'.$card['index'];
|
||||
if (!in_array($card['utilization.gpu [%]'], $invalid)) {
|
||||
$index = 'utilization.gpu.'.$card['index'];
|
||||
$descr = $descr_card . " GPU Load";
|
||||
discover_sensor('load', $device, '', $index, 'nvidia-smi', $descr, 1, $card['fan.speed [%]'], ['limit_high' => 100, 'limit_low' => 0], 'agent');
|
||||
$agent_sensors['load']['nvidia-smi'][$index] = array('description' => $descr, 'current' => $card['utilisation.gpu [%]'], 'index' => $index);
|
||||
print_cli_data("utilisation.gpu", $card['utilisation.gpu [%]']."");
|
||||
discover_sensor('load', $device, '', $index, 'nvidia-smi', $descr, 1, $card['utilization.gpu [%]'], [ 'limit_high' => 100, 'limit_low' => 0 ], 'agent');
|
||||
$agent_sensors['load']['nvidia-smi'][$index] = [ 'description' => $descr, 'current' => $card['utilization.gpu [%]'], 'index' => $index ];
|
||||
print_cli_data("utilization.gpu", $card['utilization.gpu [%]']."");
|
||||
}
|
||||
|
||||
if (!in_array($card['utilisation.memory [%]'], ['[Not Supported]', 'N/A', '[N/A]']))
|
||||
{
|
||||
$index = 'utilisation.memory.'.$card['index'];
|
||||
if (!in_array($card['utilization.memory [%]'], $invalid)) {
|
||||
$index = 'utilization.memory.'.$card['index'];
|
||||
$descr = $descr_card . " Memory Load";
|
||||
discover_sensor('load', $device, '', $index, 'nvidia-smi', $descr, 1, $card['fan.speed [%]'], ['limit_high' => 100, 'limit_low' => 0], 'agent');
|
||||
$agent_sensors['load']['nvidia-smi'][$index] = array('description' => $descr, 'current' => $card['utilisation.memory [%]'], 'index' => $index);
|
||||
print_cli_data("utilisation.memory", $card['utilisation.memory [%]']."");
|
||||
discover_sensor('load', $device, '', $index, 'nvidia-smi', $descr, 1, $card['utilization.memory [%]'], [ 'limit_high' => 100, 'limit_low' => 0 ], 'agent');
|
||||
$agent_sensors['load']['nvidia-smi'][$index] = [ 'description' => $descr, 'current' => $card['utilization.memory [%]'], 'index' => $index ];
|
||||
print_cli_data("utilization.memory", $card['utilization.memory [%]']."");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ if (!safe_empty($pkgs_db_id)) {
|
||||
log_event('Package removed: ' . $pkg['name'] . ' ' . $pkg['arch'] . ' ' . $pkg['version'] . ($pkg['build'] != '' ? "-" . $pkg['build'] : ''), $device, 'package');
|
||||
}
|
||||
// Multi delete
|
||||
dbDelete('packages', generate_query_values(array_keys($pkgs_db_id), 'pkg_id', NULL, OBS_DB_NO_LEADING_AND));
|
||||
dbDelete('packages', generate_query_values_ng(array_keys($pkgs_db_id), 'pkg_id'));
|
||||
}
|
||||
|
||||
echo(PHP_EOL);
|
||||
|
Reference in New Issue
Block a user