added config generation

This commit is contained in:
foo 2014-01-07 10:43:18 +00:00
parent 6b0cade9e2
commit 83ce82e72f

View File

@ -9,6 +9,8 @@ $CatchmentId = shift @ARGV;
print "Decoding...\n" if $DEBUG; print "Decoding...\n" if $DEBUG;
$in = decode_json(<>) or die; $in = decode_json(<>) or die;
print "# ln -s /path/to/river_levels_ /etc/munin/plugins/river_levels_$CatchmentId\n\n[river_levels_$CatchmentId]\nenv.urlbase http://path.to/service\nenv.catchmentname Name\nenv.stations " unless $DEBUG;
foreach $station (@{$in->{data}}) { foreach $station (@{$in->{data}}) {
if ($station->{url} =~ /CatchmentId=$CatchmentId$/) { if ($station->{url} =~ /CatchmentId=$CatchmentId$/) {
print "$station->{id}", $DEBUG ? ": $station->{station} on $station->{river}\n" : " "; print "$station->{id}", $DEBUG ? ": $station->{station} on $station->{river}\n" : " ";