@@ -193,6 +193,7 @@ package check_postgres;
193
193
' no-match-slot' => q{ No matching replication slots found due to exclusion/inclusion options} ,
194
194
' no-match-slotok' => q{ No replication slots found} ,
195
195
' no-parse-psql' => q{ Could not parse psql output!} ,
196
+ ' no-role' => q{ Need psql 9.6 or higher to use --role} ,
196
197
' no-time-hires' => q{ Cannot find Time::HiRes, needed if 'showtime' is true} ,
197
198
' opt-output-invalid' => q{ Invalid output: must be 'nagios' or 'mrtg' or 'simple' or 'cacti'} ,
198
199
' opt-psql-badpath' => q{ Invalid psql argument: must be full path to a file named psql} ,
@@ -1695,6 +1696,7 @@ package check_postgres;
1695
1696
' dbuser|u|dbuser1|u1=s@' ,
1696
1697
' dbpass|dbpass1=s@' ,
1697
1698
' dbservice|dbservice1=s@' ,
1699
+ ' role=s' ,
1698
1700
1699
1701
' PGBINDIR=s' ,
1700
1702
' PSQL=s' ,
@@ -3083,6 +3085,14 @@ sub run_command {
3083
3085
local $SIG {ALRM } = sub { die " Timed out\n " };
3084
3086
alarm 0;
3085
3087
3088
+ if ($opt {role }) {
3089
+ if ($psql_version < 9.6) {
3090
+ ndie msg(' no-role' )
3091
+ }
3092
+ else {
3093
+ push @args , ' -c' , " SET ROLE $opt {role}" ;
3094
+ }
3095
+ }
3086
3096
push @args , ' -c' , $string ;
3087
3097
3088
3098
$VERBOSE >= 3 and warn Dumper \@args ;
0 commit comments