Skip to content

Commit 469a205

Browse files
committed
Uptime info"
1 parent be4c965 commit 469a205

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

mysqltuner.pl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,7 @@ sub get_system_info {
15991599
infoprint "Network Cards : ";
16001600
infocmd_tab "ifconfig| grep -A1 mtu";
16011601
infoprint "Internal IP : " . infocmd_one "hostname -I";
1602+
$result{'Network'}{'Internal Ip'} = `ifconfig| grep -A1 mtu`;
16021603
my $httpcli = get_http_cli();
16031604
infoprint "HTTP client found: $httpcli" if defined $httpcli;
16041605

@@ -1627,7 +1628,9 @@ sub get_system_info {
16271628
infocmd_tab "top -n 1 -b | grep 'load average:'";
16281629
$result{'OS'}{'Load Average'} = `top -n 1 -b | grep 'load average:'`;
16291630

1630-
#infoprint "System Uptime Days/(HH:MM) : `uptime | awk '{print $3,$4}' | cut -f1 -d,`";
1631+
infoprint "System Uptime : ";
1632+
infocmd_tab "uptime";
1633+
$result{'OS'}{'Uptime'}= `uptime`;
16311634
}
16321635

16331636
sub system_recommendations {
@@ -6199,14 +6202,15 @@ sub dump_result {
61996202
}
62006203

62016204
my $json = JSON->new->allow_nonref;
6202-
print $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) )
6203-
->encode( \%result ) unless ( $opt{'silent'} );
6205+
print $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) )->encode( \%result );
6206+
62046207

62056208
if ( $opt{'outputfile'} ne 0 ) {
6209+
unlink $opt{'outputfile'} if (-e $opt{'outputfile'});
62066210
open my $fh, q(>), $opt{'outputfile'}
62076211
or die
62086212
"Unable to open $opt{'outputfile'} in write mode. please check permissions for this file or directory";
6209-
print $fh $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) );
6213+
print $fh $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) )->encode( \%result );
62106214
close $fh;
62116215
}
62126216
}

0 commit comments

Comments
 (0)