Skip to content

Commit

Permalink
src/pmdas/postgresql/postgresql.pmcheck: put it back
Browse files Browse the repository at this point in the history
WIP changes accidentially committed.
  • Loading branch information
kmcdonell committed Apr 14, 2024
1 parent 7624ae6 commit b28fc7f
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/pmdas/postgresql/postgresql.pmcheck
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,9 @@ _do_args "$@"

_check()
{
[ $status -eq 0 ] && return
if [ "$verbose" -gt 0 ]
then
if [ -s $tmp/out ]
then
cat $tmp/out
elif [ -n "$@" ]
then
echo "$@"
fi
fi
exit
test -n "$@" && echo "$@" >> $tmp/out
[ "$verbose" -gt 0 -a -s $tmp/out ] && cat $tmp/out
[ $status -eq 0 ] || exit
}

iam=postgresql
Expand All @@ -33,20 +24,17 @@ then
elif $sflag
then
status=0 # assume active until proven not to be
_ctl_svc state $iam >>$tmp/out || status=$?
_ctl_svc state $iam || status=$?
_check "$iam service status: $status"
[ $status -eq 0 ] || exit
_ctl_pmda state $iam >>$tmp/out || status=$?
_ctl_pmda state $iam || status=$?
_check "$iam PMDA status: $status"
[ $status -eq 0 ] || exit
# No longer use probe due to difficulties with the PMDA implementation;
# in particular it switches user to postgres which we cannot easily do.
# Heuristic instead is simply to test to see if a postgres user exists.
#PROBE="$PCP_PYTHON_PROG $PCP_PMDAS_DIR/$iam/pmda$iam.python"
#PCP_PYTHON_PROBE=1 $PROBE || status=2
id $iname >/dev/null 2>&1 || status=2
_check "$iname user status: $status"
[ $status -eq 0 ] || exit
elif $aflag
then
_ctl_pmda activate $iam pmda$iam.python || status=1
Expand Down

0 comments on commit b28fc7f

Please sign in to comment.