Last active
December 25, 2015 06:39
-
-
Save janlam7/6933731 to your computer and use it in GitHub Desktop.
Munin-plugin to create graphs from the information provided by an Enphase Envoy. Config needed for munin-node: [panels_enphase]
#ip address of the enphase equipment; compatible with at least version R3.7.16 (02cb0e)
env.enphaseipaddress 192.168.4.87
#file to store tmp data in; munin user needs rw access, persistence after a restart is a pre.
env…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use English; | |
use HTML::TableExtract; | |
use LWP::Simple; | |
my $file = $ENV{'tmpfile'}; | |
my $enphaseipaddress = $ENV{'enphaseipaddress'}; | |
my $ts; | |
my $table; | |
my $table_tree; | |
my $row = ''; | |
my $rc = getstore('http://'.$enphaseipaddress.'/home?locale=en', $file); | |
die "Failed to download document\n" unless $rc == 200; | |
my $te = HTML::TableExtract->new( | |
depth => 1, count => 0 | |
); | |
$te->parse_file($file); | |
$table = $te->first_table_found; | |
my $online = $table->cell(4,1); | |
my $rowc = $table->cell(1,1); | |
my @kwhsc = split(' ',$rowc); | |
my $kwhcur = $kwhsc[0]; | |
my $unit = $kwhsc[1]; | |
if ($unit eq "kW") { | |
$kwhcur = $kwhcur * 1000; | |
} | |
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) { | |
print "graph_title Generating\n"; | |
print "graph_vlabel Watt\n"; | |
print "graph_args --base 1000\n"; | |
print "online.label Inverters online\n"; | |
print "online.max 9\n"; | |
print "online.type GAUGE\n"; | |
print "kwhcur.label According to current statistics\n"; | |
print "kwhcur.max 2250\n"; | |
print "kwhcur.min 0\n"; | |
print "kwhcur.type GAUGE\n"; | |
} | |
printf "online.value %s\n", $online; | |
printf "kwhcur.value %s\n", $kwhcur; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment