=head1 NAME
-virt-uname, virt-ps, virt-ping - virtual machine information and statistics
+virt-ps, virt-ping, virt-uname, virt-uptime - virtual machine information and statistics
=head1 SYNOPSIS
- virt-uname [--options] [domname]
+ virt-ifconfig [--options] [domname]
virt-ps [--options] [domname]
virt-ping [--options] [domname]
- virt-ifconfig [--options] [domname]
+ virt-uname [--options] [domname]
+
+ virt-uptime [--options] [domname]
=head1 COMMON OPTIONS
}
my %subcommands = (
- "virt-uname" => [ \&do_uname, \&title_uname ],
"virt-ps" => [ \&do_ps, \&title_ps ],
"virt-ping" => [ \&do_ping, \&title_ping ],
+ "virt-uname" => [ \&do_uname, \&title_uname ],
+ "virt-uptime" => [ \&do_uptime, \&title_uptime ],
);
# Which subcommand?
exit ($errors == 0 ? 0 : 1);
-=head1 virt-uname
-
-C<virt-uname> displays the system information (kernel version etc) of
-the guest.
-
-=cut
-
-sub title_uname
-{
- print_row (__"Guest", __"System name");
-}
+# virt-ifconfig is implemented as a separate program.
-sub do_uname
-{
- my $domname = shift;
- my $key = shift;
- my $transport = shift;
+=head1 virt-ifconfig
- my $session = get_snmp_session ($key, $transport);
- my $sysDescr = "1.3.6.1.2.1.1.1.0";
- my $r = $session->get_request (-varbindlist => [$sysDescr])
- or die __x("SNMP error: {e}", $session->error);
- print_row ($domname, $r->{$sysDescr});
- $session->close;
-}
+C<virt-ifconfig> displays the IP address of the guest.
=head1 virt-ps
}
-# virt-ifconfig is implemented separately.
+=head1 virt-uname
-=head1 virt-ifconfig
+C<virt-uname> displays the system information (kernel version etc) of
+the guest.
-C<virt-ifconfig> displays the IP address of the guest.
+=cut
+
+sub title_uname
+{
+ print_row (__"Guest", __"System name");
+}
+
+sub do_uname
+{
+ my $domname = shift;
+ my $key = shift;
+ my $transport = shift;
+
+ my $session = get_snmp_session ($key, $transport);
+ my $sysDescr = "1.3.6.1.2.1.1.1.0";
+ my $r = $session->get_request (-varbindlist => [$sysDescr])
+ or die __x("SNMP error: {e}", $session->error);
+ print_row ($domname, $r->{$sysDescr});
+ $session->close;
+}
+
+=head1 virt-uptime
+
+C<virt-uptime> displays the uptime of the guest
=cut
+sub title_uptime
+{
+ print_row (__"Guest", __"Uptime");
+}
+
+sub do_uptime
+{
+ my $domname = shift;
+ my $key = shift;
+ my $transport = shift;
+
+ my $session = get_snmp_session ($key, $transport);
+ my $sysUpTime = "1.3.6.1.2.1.1.3.0";
+ my $r = $session->get_request (-varbindlist => [$sysUpTime])
+ or die __x("SNMP error: {e}", $session->error);
+ print_row ($domname, $r->{$sysUpTime});
+ $session->close;
+}
+
sub print_row
{
my @fields = @_;