MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /usr/local/src/munin-1.2.6/node/node.d/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/src/munin-1.2.6/node/node.d/nut_volts.in
#!@@PERL@@

use strict;

my %status;

my %config = (
	upsname => 'bertha@127.0.0.1',
	upsc => 'upsc'
);

my %graph =  (
	'input_voltage' => {
				label => 'input',
				type => 'GAUGE',
				draw => 'LINE2'
			 },
	'input_voltage_maximum' => {
				label => 'max input seen',
				type => 'GAUGE',
				draw => 'LINE1'
			 },
	'input_voltage_minimum' => {
				label => 'min input seen',
				type => 'GAUGE',
				draw => 'LINE1'
			 },
	'output_voltage' => {
				label => 'output',
				type => 'GAUGE',
				draw => 'LINE2'
			 }
);

if ( defined $ARGV[0] and $ARGV[0] eq 'config' ) {
	print "graph_title UPS Voltages - $config{upsname}\n";
	print "graph_args -l 115\n";
	print "graph_vlabel Volts\n";
	foreach my $key (keys %graph) {
		print "$key.label $graph{$key}->{label}\n";
		print "$key.type $graph{$key}->{type}\n";
		print "$key.draw $graph{$key}->{draw}\n";
	}
} else {
	&fetch_values;
}

sub fetch_values {
	my $data = `$config{upsc} $config{upsname}`;
	while ($data =~ /([a-z.]+): (.+)\b/g) {
		my $label = $1;
		my $value = $2;
		$label =~ s/\./_/g;
		$status{$label} = $value;
	}
	foreach my $label (sort keys %graph) {
		print "$label.value $status{$label}\n";
	}
}


Anon7 - 2021