Refactored Nvidia Application (#10037)

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [ ] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`.  If there are schema changes, you can ask on discord how to revert.
This commit is contained in:
Tim de Boer
2019-04-09 15:47:43 +02:00
committed by Neil Lathwood
parent 780ee36b10
commit 91ca7b37fe
3 changed files with 36 additions and 30 deletions

View File

@@ -211,6 +211,7 @@ LibreNMS contributors:
- Joel Kociolek <joel@kociolek.org> (lejoko)
- Rémy Jacquin <remy@remyj.fr> (remyj38)
- PipoCanaja <pipocanaja@gmail.com> [pipocanaja](https://github.com/pipocanaja/)
- Tim de Boer <tim+github@tim427.net> (tim427)
Observium was written by:
- Adam Armstrong

View File

@@ -1,13 +1,12 @@
<?php
$name = 'nvidia';
$app_id = $app['app_id'];
$colours = 'manycolours';
$name = 'nvidia';
$app_id = $app['app_id'];
$colours = 'greens';
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 15;
$name = 'nvidia';
$app_id = $app['app_id'];
$app_id = $app['app_id'];
$int=0;
$rrd_list=array();

View File

@@ -34,36 +34,42 @@ $sm_total = 0;
$metrics = array();
foreach ($gpuArray as $index => $gpu) {
$stats = explode(",", $gpu);
$sm_total += $stats[3];
list($gpu, $pwr, $temp, $sm, $mem, $enc, $dec, $mclk, $pclk, $pviol, $tviol,
if (count($stats) == 19) {
list($gpu, $pwr, $temp, $memtemp, $sm, $mem, $enc, $dec, $mclk, $pclk, $pviol, $tviol,
$fb, $bar1, $sbecc, $dbecc, $pci, $rxpci, $txpci)=$stats;
} else {
list($gpu, $pwr, $temp, $sm, $mem, $enc, $dec, $mclk, $pclk, $pviol, $tviol,
$fb, $bar1, $sbecc, $dbecc, $pci, $rxpci, $txpci)=$stats;
}
$rrd_name = array('app', $name, $app_id, $index);
$sm_total += $sm;
$fields = array(
'pwr' => $pwr,
'temp' => $temp,
'sm' => $sm,
'mem' => $mem,
'enc' => $enc,
'dec' => $dec,
'mclk' => $mclk,
'pclk' => $pclk,
'pviol' => $pviol,
'tviol' => $tviol,
'fb' => $fb,
'bar1' => $bar1,
'sbecc' => $sbecc,
'dbecc' => $dbecc,
'pci' => $pci,
'rxpci' => $rxpci,
'txpci' => $txpci
);
$metrics[$index] = $fields;
$rrd_name = array('app', $name, $app_id, $index);
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
$fields = array(
'pwr' => $pwr,
'temp' => $temp,
'sm' => $sm,
'mem' => $mem,
'enc' => $enc,
'dec' => $dec,
'mclk' => $mclk,
'pclk' => $pclk,
'pviol' => $pviol,
'tviol' => $tviol,
'fb' => $fb,
'bar1' => $bar1,
'sbecc' => $sbecc,
'dbecc' => $dbecc,
'pci' => $pci,
'rxpci' => $rxpci,
'txpci' => $txpci
);
$metrics[$index] = $fields;
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
}
$sm_average = ($sm_total ? ($sm_total / count($gpuArray)) : 0);