diff --git a/postgresqltuner.pl b/postgresqltuner.pl index 75dd983..2ab9bbf 100755 --- a/postgresqltuner.pl +++ b/postgresqltuner.pl @@ -29,6 +29,7 @@ use Config; my $os={}; +# Set default OS settings from local system $os->{name}=$Config{osname}; $os->{arch}=$Config{archname}; $os->{version}=$Config{osvers}; @@ -246,13 +247,18 @@ sub usage { } if (defined(os_cmd("true"))) { $can_run_os_cmd=1; - print_report_ok("I can invoke executables"); + print_report_ok("I can invoke executables"); } else { - print_report_bad("I CANNOT invoke executables, my report will be incomplete"); + print_report_bad("I CANNOT invoke executables, my report will be incomplete"); add_advice("reporting","high","Please configure your .ssh/config to allow postgresqltuner.pl to connect via ssh to $host without password authentication. This will allow it to collect more system informations"); } } +# Gather OS information from actual target system +$os->{name}=os_cmd('\'perl -e "use strict; use warnings; use Config; print(\$Config{osname});"\''); +$os->{arch}=os_cmd('\'perl -e "use strict; use warnings; use Config; print(\$Config{archname});"\''); +$os->{version}=os_cmd('\'perl -e "use strict; use warnings; use Config; print(\$Config{osvers});"\''); + # Database connection print "Connecting to $host:$port database $database as user '$username'...\n"; my $dbh = DBI->connect("dbi:Pg:dbname=$database;host=$host;port=$port;",$username,$password,{AutoCommit=>1,RaiseError=>1,PrintError=>0});