mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-23 06:35:42 +00:00
autoconf, some minor changes
This commit is contained in:
parent
3037bb866f
commit
54977029d5
1 changed files with 41 additions and 35 deletions
|
@ -33,6 +33,7 @@ The plugin shows:
|
|||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=power
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
|
@ -183,30 +184,32 @@ sub read_data
|
|||
{
|
||||
if($sys_data_exists)
|
||||
{
|
||||
$data->{$i}{'design_capacity'} = read_sys_data($i, 'charge_full_design')/1000000;
|
||||
$data->{$i}{'last_full_capacity'} = read_sys_data($i, 'charge_full')/1000000;
|
||||
$data->{$i}{'remaining_capacity'} = read_sys_data($i, 'charge_now')/1000000;
|
||||
$data->{$i}{'design_voltage'} = read_sys_data($i, 'voltage_min_design')/1000000;
|
||||
$data->{$i}{'present_voltage'} = read_sys_data($i, 'voltage_now')/1000000;
|
||||
$data->{$i}{'present_rate'} = read_sys_data($i, 'current_now')/1000000;
|
||||
my $divider = 1000000; # need for equvivalent sys and proc data
|
||||
$data->{$i}{'design_capacity'} = read_sys_data($i, 'charge_full_design')/$divider;
|
||||
$data->{$i}{'last_full_capacity'} = read_sys_data($i, 'charge_full') /$divider;
|
||||
$data->{$i}{'remaining_capacity'} = read_sys_data($i, 'charge_now') /$divider;
|
||||
$data->{$i}{'design_voltage'} = read_sys_data($i, 'voltage_min_design')/$divider;
|
||||
$data->{$i}{'present_voltage'} = read_sys_data($i, 'voltage_now') /$divider;
|
||||
$data->{$i}{'present_rate'} = read_sys_data($i, 'current_now') /$divider;
|
||||
}
|
||||
if($proc_data_exists)
|
||||
{
|
||||
my $divider = 1000; # need for equvivalent sys and proc data
|
||||
my $proc_info = read_proc_data($i, 'info');
|
||||
unless($sys_data_exists)
|
||||
{
|
||||
my $proc_state = read_proc_data($i, 'state');
|
||||
$data->{$i}{'design_capacity'} = $proc_info ->{'design capacity'}/1000;
|
||||
$data->{$i}{'last_full_capacity'} = $proc_info ->{'last full capacity'}/1000;
|
||||
$data->{$i}{'remaining_capacity'} = $proc_state->{'remaining capacity'}/1000;
|
||||
$data->{$i}{'design_voltage'} = $proc_info ->{'design voltage'}/1000;
|
||||
$data->{$i}{'present_voltage'} = $proc_state->{'present voltage'}/1000;
|
||||
$data->{$i}{'present_rate'} = $proc_state->{'present rate'}/1000;
|
||||
$data->{$i}{'design_capacity'} = $proc_info ->{'design capacity'} /$divider;
|
||||
$data->{$i}{'last_full_capacity'} = $proc_info ->{'last full capacity'}/$divider;
|
||||
$data->{$i}{'remaining_capacity'} = $proc_state->{'remaining capacity'}/$divider;
|
||||
$data->{$i}{'design_voltage'} = $proc_info ->{'design voltage'} /$divider;
|
||||
$data->{$i}{'present_voltage'} = $proc_state->{'present voltage'} /$divider;
|
||||
$data->{$i}{'present_rate'} = $proc_state->{'present rate'} /$divider;
|
||||
}
|
||||
$data->{$i}{'design_capacity_low'} = $proc_info ->{'design capacity low'}/1000;
|
||||
$data->{$i}{'design_capacity_warning'} = $proc_info ->{'design capacity warning'}/1000;
|
||||
$data->{$i}{'capacity_granularity_1'} = $proc_info ->{'capacity granularity 1'}/1000;
|
||||
$data->{$i}{'capacity_granularity_2'} = $proc_info ->{'capacity granularity 2'}/1000;
|
||||
$data->{$i}{'design_capacity_low'} = $proc_info ->{'design capacity low'} /$divider;
|
||||
$data->{$i}{'design_capacity_warning'} = $proc_info ->{'design capacity warning'}/$divider;
|
||||
$data->{$i}{'capacity_granularity_1'} = $proc_info ->{'capacity granularity 1'} /$divider;
|
||||
$data->{$i}{'capacity_granularity_2'} = $proc_info ->{'capacity granularity 2'} /$divider;
|
||||
}
|
||||
$data->{$i}{'current_voltage_percent'} = percent($data->{$i}{'design_voltage'} , $data->{$i}{'present_voltage'});
|
||||
$data->{$i}{'current_capacity_percent'} = percent($data->{$i}{'last_full_capacity'}, $data->{$i}{'remaining_capacity'});
|
||||
|
@ -247,6 +250,12 @@ my $fields =
|
|||
|
||||
# ------------------------------------ start here -----------------------------------
|
||||
|
||||
if (defined($ARGV[0]) and ($ARGV[0] eq 'autoconf'))
|
||||
{
|
||||
printf("%s\n", (-e $proc_path or -e $sys_path) ? "yes" : "no ($proc_path and $sys_path not exists)");
|
||||
exit (0);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
|
@ -348,6 +357,3 @@ foreach my $graph (sort keys %{$graphs})
|
|||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue