From 99ea9f36cbf73727e2e992491a62c56bc989370f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Po=CC=88lzinger?= Date: Sat, 11 Mar 2023 10:18:22 +0100 Subject: [PATCH 1/2] Add gathering of OS information from actual target system --- postgresqltuner.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/postgresqltuner.pl b/postgresqltuner.pl index 75dd983..647483a 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"); 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}); From 5bb33f4baccbc8fddee3c5b47bca98d9bb7bf81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Po=CC=88lzinger?= Date: Sat, 11 Mar 2023 10:24:54 +0100 Subject: [PATCH 2/2] Fix indent in SSH block --- postgresqltuner.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgresqltuner.pl b/postgresqltuner.pl index 647483a..2ab9bbf 100755 --- a/postgresqltuner.pl +++ b/postgresqltuner.pl @@ -249,7 +249,7 @@ sub usage { $can_run_os_cmd=1; 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"); } }