-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1942 from natoscott/postgres-pmcheck
pmcheck: improve redis, add postgresql and uwsgi checks
- Loading branch information
Showing
13 changed files
with
181 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
domain.h | ||
pmns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
# | ||
# Postgresql PMDA "plugin" for pmcheck | ||
# | ||
|
||
. $PCP_DIR/etc/pcp.env || exit 1 | ||
. $PCP_SHARE_DIR/lib/checkproc.sh | ||
|
||
_do_args "$@" | ||
|
||
_check() | ||
{ | ||
test -n "$@" && echo "$@" >> $tmp/out | ||
[ "$verbose" -gt 0 -a -s $tmp/out ] && cat $tmp/out | ||
[ $status -eq 0 ] || exit | ||
} | ||
|
||
iam=postgresql | ||
iname=postgres | ||
|
||
if $lflag | ||
then | ||
[ "$verbose" -gt 0 ] && echo "PostgreSQL PMDA - metrics from PostgreSQL" | ||
elif $sflag | ||
then | ||
status=0 # assume active until proven not to be | ||
_ctl_svc state $iam || status=$? | ||
_check "$iam service status: $status" | ||
_ctl_pmda state $iam || status=$? | ||
_check "$iam PMDA status: $status" | ||
# 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" | ||
elif $aflag | ||
then | ||
_ctl_pmda activate $iam pmda$iam.python || status=1 | ||
elif $dflag | ||
then | ||
_ctl_pmda deactivate $iam || status=1 | ||
else | ||
[ $verbose -gt 0 ] && echo "botch sflag=$sflag aflag=$aflag dflag=$dflag show_me=$show_me verbose=$verbose" | ||
status=99 | ||
fi | ||
|
||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
# | ||
# uWSGI PMDA "plugin" for pmcheck | ||
# | ||
|
||
. $PCP_DIR/etc/pcp.env || exit 1 | ||
. $PCP_SHARE_DIR/lib/checkproc.sh | ||
|
||
_do_args "$@" | ||
|
||
_check() | ||
{ | ||
test -n "$@" && echo "$@" >> $tmp/out | ||
[ "$verbose" -gt 0 -a -s $tmp/out ] && cat $tmp/out | ||
[ $status -eq 0 ] || exit | ||
} | ||
|
||
iam=uwsgi | ||
if $lflag | ||
then | ||
[ "$verbose" -gt 0 ] && echo "uWSGI PMDA - metrics from uWSGI servers" | ||
elif $sflag | ||
then | ||
status=0 # assume active until proven not to be | ||
_ctl_pmda state $iam || status=$? | ||
PROBE="$PCP_PMDAS_DIR/$iam/pmda$iam.python --probe" | ||
PCP_PYTHON_PROBE=1 $PCP_PYTHON_PROG $PROBE || status=2 | ||
_check "$iam PMDA status: $status" | ||
elif $aflag | ||
then | ||
_ctl_pmda activate $iam pmda$iam.python || status=1 | ||
elif $dflag | ||
then | ||
_ctl_pmda deactivate $iam || status=1 | ||
else | ||
[ $verbose -gt 0 ] && echo "botch sflag=$sflag aflag=$aflag dflag=$dflag show_me=$show_me verbose=$verbose" | ||
status=99 | ||
fi | ||
|
||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters