Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gather os information via ssh #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions postgresqltuner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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});
Expand Down