1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Clean field name

Spaces are illegal in munin field names, so clean the name of the encoder before using it.
This commit is contained in:
asgh 2014-09-29 03:15:07 -04:00
parent 33ac3beeb3
commit 8af081433c

View file

@ -74,6 +74,7 @@ use DBI;
use MythTV; use MythTV;
use strict; use strict;
use warnings; use warnings;
use Munin::Plugin;
# SQL parameters are read from mysql.txt # SQL parameters are read from mysql.txt
# There should be no need to change anything after this point # There should be no need to change anything after this point
@ -116,6 +117,7 @@ PrepSQLRead();
@result=SQLQuery("SELECT `name` FROM `videosource`"); @result=SQLQuery("SELECT `name` FROM `videosource`");
my $First=0; my $First=0;
foreach $gata (@result) { foreach $gata (@result) {
$gata = clean_fieldname($gata);
print "ActiveEncoders$gata.draw "; print "ActiveEncoders$gata.draw ";
if ( $First == 0 ) { if ( $First == 0 ) {
print "AREA\n"; print "AREA\n";
@ -275,7 +277,7 @@ PrepSQLRead();
} }
foreach $Name (keys %Names) { foreach $Name (keys %Names) {
if ( $Name ne "" ) { if ( $Name ne "" ) {
print "ActiveEncoders$Name.value $Names{$Name}\n"; print "ActiveEncoders" . clean_fieldname($Name) . ".value $Names{$Name}\n";
} }
} }
print "FreeEncoders.value $FreeRecorders\n"; print "FreeEncoders.value $FreeRecorders\n";