* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-7.sme
- Enhance UPS Status screen [SME: ]
This commit is contained in:
@@ -77,7 +77,7 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
#'Data1'=>'Data for STATUS', #Example
|
||||
# fields from Inputs in STATUS $fields['STATUS']
|
||||
'UPSStatus'=>$c->get_ups_status(),
|
||||
|
||||
'ups_data' => $c->get_ups_status_as_hash()
|
||||
);
|
||||
return %ret;
|
||||
}
|
||||
@@ -239,6 +239,16 @@ sub get_ups_status {
|
||||
}
|
||||
}
|
||||
|
||||
sub get_ups_status_as_hash {
|
||||
$c = shift;
|
||||
$string = $c->get_ups_status();
|
||||
my %hash;
|
||||
while ($string =~ /^(.+?):\s*(.+)$/mg) {
|
||||
$hash{$1} = $2;
|
||||
}
|
||||
return \%hash
|
||||
}
|
||||
|
||||
sub get_status_from_device {
|
||||
my ($c,$device) = @_;
|
||||
my $command = '/usr/bin/upsc';
|
||||
|
Reference in New Issue
Block a user