space on type like "OOB Management" cause issue on smokeping, edit ge… (#11160)

* space on type like "OOB Management" cause issue on smokeping, edit gen_smokeping script to replace dot and space

* create fonction for replace dot and space

* correct indentation

* moving function to functions.php

* correct function name

* Remove function

this should not be a function...

* Remove function

* Update gen_smokeping.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
joretapoo
2020-02-26 18:43:21 +01:00
committed by GitHub
parent 79f2debbdb
commit 277333c752

View File

@@ -13,7 +13,6 @@
$init_modules = array();
require realpath(__DIR__ . '/..') . '/includes/init.php';
?>
menu = Top
@@ -22,12 +21,12 @@ title = Network Latency Grapher
<?php
foreach (dbFetchRows("SELECT `type` FROM `devices` WHERE `ignore` = 0 AND `disabled` = 0 AND `type` != '' GROUP BY `type`") as $groups) {
echo '+ ' . $groups['type'] . PHP_EOL;
//Dot and space need to be replaced, since smokeping doesn't accept it at this level
echo '+ ' . str_replace(['.', ' '], '_', $groups['type']) . PHP_EOL;
echo 'menu = ' . $groups['type'] . PHP_EOL;
echo 'title = ' . $groups['type'] . PHP_EOL;
foreach (dbFetchRows("SELECT `hostname` FROM `devices` WHERE `type` = ? AND `ignore` = 0 AND `disabled` = 0", array($groups['type'])) as $devices) {
//Dot needs to be replaced, since smokeping doesn't accept it at this level
echo '++ ' . str_replace(".", "_", $devices['hostname']) . PHP_EOL;
echo '++ ' . str_replace(['.', ' '], '_', $devices['hostname']) . PHP_EOL;
echo 'menu = ' . $devices['hostname'] . PHP_EOL;
echo 'title = ' . $devices['hostname'] . PHP_EOL;
echo 'host = ' . $devices['hostname'] . PHP_EOL . PHP_EOL;