Include to read graphs from the graph_types table

This commit is contained in:
Paul Gear
2015-06-13 22:41:21 +10:00
parent 6038f11db9
commit e884bfa860

View File

@@ -0,0 +1,22 @@
<?php
/*
* LibreNMS dynamic graph types
*
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
// load graph types from the database
foreach (dbFetchRows('select * from graph_types') as $graph) {
// remove leading 'graph_' from column names
foreach ($graph as $k => $v) {
$key = strpos($k, 'graph_') == 0 ? str_replace('graph_', '', $k) : $k;
$g[$key] = $v;
}
$config['graph_types'][$g['type']][$g['subtype']] = $g;
}