mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 10:28:36 +00:00
Plugin-Gallery: Get better 2nd level headings
sensors, weather, snmp
This commit is contained in:
parent
37d658526b
commit
95de964ec9
24 changed files with 10 additions and 10 deletions
|
@ -108,7 +108,7 @@ if($stationName eq "") {
|
|||
# Output for config
|
||||
if(defined $ARGV[0] && $ARGV[0] eq 'config') {
|
||||
print "graph_title ".$stationName."\n";
|
||||
print "graph_category Weather\n";
|
||||
print "graph_category sensors\n";
|
||||
if($LAN eq "nl") {
|
||||
# Dutch Language
|
||||
if($TMP eq "yes") { print "tmp.label Temperatuur (C)\n"; }
|
||||
|
@ -181,4 +181,4 @@ sub print_stations {
|
|||
." [6319] Terneuzen (Station Westdorpe) [6248] Hoorn (Station Wijdenes)\n"
|
||||
." [6257] Wijk aan Zee (Station Wijk aan Zee) [6340] Woensdrecht (Station Woensdrecht)\n"
|
||||
." [6239] Noordzee (Station Zeeplatform F-3) [6252] Noordzee (Station Zeeplatform K13)\n";
|
||||
}
|
||||
}
|
||||
|
|
72
plugins/weather/humidity-sensor
Executable file
72
plugins/weather/humidity-sensor
Executable file
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) Viktoras Pecia 2010(Based on 2006 Lars Strand "temperatures" code)
|
||||
#
|
||||
# Plugin to fetch humidity from weather.noaa.gov
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
my @wcode = undef;
|
||||
if (defined($ENV{wcode})) {
|
||||
@wcode = split(' ', $ENV{wcode});
|
||||
} else {
|
||||
@wcode = ("EYSA","EYKA","EYPA","EYVI");
|
||||
}
|
||||
my $proxy = $ENV{proxy} || undef; # Example: "http://proxy.foo.bar:8080/"
|
||||
my $ret = undef;
|
||||
if (! eval "require LWP::UserAgent;")
|
||||
{
|
||||
$ret = "LWP::UserAgent not found";
|
||||
}
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "autoconf") {
|
||||
if (defined $ret) {
|
||||
print "no ($ret)\n";
|
||||
exit 1;
|
||||
} else {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
my $datasource = "http://weather.noaa.gov/pub/data/observations/metar/decoded/";
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 30);
|
||||
$ua->agent('Munin');
|
||||
# Use proxy, if defined.
|
||||
if (defined($proxy)) {
|
||||
$ua->proxy(['http'], $proxy);
|
||||
}
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
print "graph_title Humidity\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows humidity fetched from weather.nooa.gov.\n";
|
||||
print "graph_vlabel humidity in %\n";
|
||||
for my $station (@wcode) {
|
||||
my $url = "$datasource$station.TXT";
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
# New York City, Central Park, NY, United States (KNYC) 40-47-00N 073-58-00W 48M
|
||||
if ($response->content =~ /^((.*?),.*\)).*\n/) {
|
||||
print "$station.label $2\n";
|
||||
print "$station.info $1\n";
|
||||
} else {
|
||||
print "$station.label $station\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
for my $station (@wcode) {
|
||||
my $url = "$datasource$station.TXT";
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
if ($response->content =~ /Relative Humidity:\s*(\d+)\%.*/) {
|
||||
print "$station.value $1\n";
|
||||
} else {
|
||||
print "$station.value U\n";
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ then
|
|||
multigraph $plugin_name
|
||||
graph_title Temperature in ${CITY}
|
||||
graph_vlabel Celsius
|
||||
graph_category weather
|
||||
graph_category sensors
|
||||
graph_info This graph show the temperature in ${CITY}
|
||||
temp_avg.label avg
|
||||
temp_avg.cdef $KELVIN_BIAS,-
|
||||
|
@ -42,7 +42,7 @@ then
|
|||
multigraph $plugin_name.temp
|
||||
graph_title Temperature in ${CITY}
|
||||
graph_vlabel Celsius
|
||||
graph_category weather
|
||||
graph_category sensors
|
||||
graph_info This graph show the temperature in ${CITY}
|
||||
temp_avg.label avg
|
||||
temp_avg.cdef $KELVIN_BIAS,-
|
||||
|
@ -54,28 +54,28 @@ then
|
|||
multigraph $plugin_name.humidity
|
||||
graph_title Humidity in ${CITY}
|
||||
graph_vlabel %
|
||||
graph_category weather
|
||||
graph_category sensors
|
||||
graph_info This graph show the humidity in ${CITY}
|
||||
humidity.label humidity
|
||||
|
||||
multigraph $plugin_name.pressure
|
||||
graph_title Pressure in ${CITY}
|
||||
graph_vlabel hPa
|
||||
graph_category weather
|
||||
graph_category sensors
|
||||
graph_info This graph show the pressure in ${CITY}
|
||||
pressure.label pressure
|
||||
|
||||
multigraph $plugin_name.wind_speed
|
||||
graph_title Wind Speed in ${CITY}
|
||||
graph_vlabel m/s
|
||||
graph_category weather
|
||||
graph_category sensors
|
||||
graph_info This graph show the wind speed in ${CITY}
|
||||
speed.label wind speed
|
||||
|
||||
multigraph $plugin_name.wind_direction
|
||||
graph_title Wind direction in ${CITY}
|
||||
graph_vlabel m/s
|
||||
graph_category weather
|
||||
graph_category sensors
|
||||
graph_info This graph show the wind direction in ${CITY}
|
||||
direction.label wind direction
|
||||
EOF
|
||||
|
|
|
@ -32,7 +32,7 @@ elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
|||
|
||||
print 'graph_title Atmospheric pressure at code %s' % code
|
||||
print 'graph_vlabel Pressure in hPa'
|
||||
print 'graph_category Weather'
|
||||
print 'graph_category sensors'
|
||||
|
||||
print 'pressure.label Pressure'
|
||||
print 'pressure.type GAUGE'
|
||||
|
|
|
@ -32,7 +32,7 @@ elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
|||
|
||||
print 'graph_title Temperature and Dew Point at code %s' % code
|
||||
print 'graph_vlabel Temperature and Dew Point in C'
|
||||
print 'graph_category Weather'
|
||||
print 'graph_category sensors'
|
||||
|
||||
print 'temperature.label Temperature'
|
||||
print 'dewpoint.label Dew Point'
|
||||
|
|
99
plugins/weather/wfrog
Executable file
99
plugins/weather/wfrog
Executable file
|
@ -0,0 +1,99 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Author: William Viker <william.viker@gmail.com>
|
||||
# Version: 0.1
|
||||
|
||||
# Non-members may check out a read-only working copy anonymously over HTTP.
|
||||
# $ svn checkout http://wfrogmunin.googlecode.com/svn/trunk/ wfrogmunin-read-only
|
||||
|
||||
# TODO:
|
||||
# * Wait a couple of hours to see if this actually works.
|
||||
# * Add proper data labels for the different values possible
|
||||
# * more..
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
||||
# INSTRUCTIONS
|
||||
#
|
||||
# 1. Install wfrog, get it up running with your weather station
|
||||
# 2. Locate your wfrog.csv file (wfrog creates after 10 mins)
|
||||
# 3. cd /etc/munin/plugins/
|
||||
# 4. ln -s /usr/share/munin/plugins/wfrog wfrog_temp
|
||||
# 4. ln -s /usr/share/munin/plugins/wfrog wfrog_pressure
|
||||
# 5. etc..
|
||||
# 6. reload munin-node ;-)
|
||||
|
||||
|
||||
# In case you need to change this.
|
||||
|
||||
my %CONFIG = (
|
||||
'wfrogcsv' => '/var/lib/wfrog/wfrog.csv',
|
||||
);
|
||||
|
||||
|
||||
my $interesting;
|
||||
|
||||
if ($0 =~ m#wfrog_(\w+)#) {
|
||||
$interesting = $1;
|
||||
}
|
||||
|
||||
else {
|
||||
print STDERR "Symlink the wfrog plugin file to wfrog_something, like wfrog_temperature, etc." . "\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'autoconf') {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
open FILE, "<", $CONFIG{'wfrogcsv'};
|
||||
|
||||
my $header = <FILE>;
|
||||
|
||||
seek( FILE, -300, 2 );
|
||||
my @line = readline FILE;
|
||||
|
||||
$header =~ s/[\r\n]//gs; # bah @ csv
|
||||
$line[-1] =~ s/[\r\n]//gs; # --- " ---
|
||||
|
||||
my @Data = split /,/, $line[-1];
|
||||
my @Keys = split /,/, $header;
|
||||
|
||||
my $GotKeyName;
|
||||
my $GotKeyData;
|
||||
my $cpos = 0;
|
||||
|
||||
for (@Keys) {
|
||||
if ($_ eq $interesting) {
|
||||
$GotKeyName = $_;
|
||||
if (defined $Data[$cpos]) {
|
||||
$GotKeyData = $Data[$cpos];
|
||||
}
|
||||
}
|
||||
$cpos++;
|
||||
}
|
||||
|
||||
unless (defined $GotKeyName) {
|
||||
print STDERR "Could not find any data on '$interesting'. Does the file contain any data?\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $graph_name = $GotKeyName;
|
||||
$graph_name =~ s/[^a-z]//gi;
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'config') {
|
||||
print "graph_title WFrog $GotKeyName\n"
|
||||
. "graph_args --base 1000 -l 0\n"
|
||||
. "graph_vlabel Value\n"
|
||||
. "graph_scale yes\n"
|
||||
. "graph_category sensors\n"
|
||||
# . "graph_printf %3.0lf\n"
|
||||
. "$graph_name.label $GotKeyName\n"
|
||||
. "$graph_name.draw AREASTACK\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print "$graph_name.value $GotKeyData\n";
|
Loading…
Add table
Add a link
Reference in a new issue