Skip to content

Commit

Permalink
pmcheck plugins: overhead PMDA and pcp-zeroconf package
Browse files Browse the repository at this point in the history
These two are not available for non-Linux systems, so for systems
like FreeBSD install an alternate plugin that can inform the use why
these components cannot be controlled with pmcheck.

This is a proof of concept, the same approach can be applied to
other "components" that are not unniversally available.
  • Loading branch information
kmcdonell committed Mar 22, 2024
1 parent 5b5ecab commit c69d3af
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pmdas/overhead/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ install: build-me
else
build-me:
install:
$(INSTALL) -m 755 overhead.pmcheck $(PCP_SHARE_DIR)/lib/pmcheck/pmda-overhead
$(INSTALL) -m 755 no.overhead.pmcheck $(PCP_SHARE_DIR)/lib/pmcheck/pmda-overhead
endif

$(CMDTARGET): $(OBJECTS)
Expand Down
31 changes: 31 additions & 0 deletions src/pmdas/overhead/no.overhead.pmcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
#
# ohead PMDA "plugin" for pmcheck ...
# this version is for distros/platforms/builds where the PMDA is not
# available (currently anything other than Linux)
#

. $PCP_DIR/etc/pcp.env || exit 1
. $PCP_SHARE_DIR/lib/checkproc.sh

_do_args "$@"

na="not currently available for `uname -s`"

if $lflag
then
[ "$verbose" -gt 0 ] && echo "PCP overhead PMDA - $na" ]
elif $sflag
then
status=2
[ "$verbose" -gt 0 ] && echo "overhead PMDA $na"
elif $aflag || $dflag
then
status=1
[ "$verbose" -gt 0 ] && echo "overhead PMDA $na"
else
[ $verbose -gt 0 ] && echo "botch sflag=$sflag aflag=$aflag dflag=$dflag show_me=$show_me verbose=$verbose"
status=99
fi

exit
7 changes: 5 additions & 2 deletions src/pmlogconf/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ SUBDIRS = \
#
ifeq "$(TARGET_OS)" "linux"
SUBDIRS += zeroconf
PMCHECK=zeroconf.pmcheck
else
PMCHECK=no.zeroconf.pmcheck
endif

default: $(CMDTARGET) pmrepconf makefiles zeroconf.pmcheck
default: $(CMDTARGET) pmrepconf makefiles $(PMCHECK)

include $(BUILDRULES)

Expand All @@ -57,7 +60,7 @@ install: default $(SUBDIRS)
$(INSTALL) -m 755 $(CMDTARGET) $(DISTARGET)
$(INSTALL) -S $(DISTARGET) $(PCP_BIN_DIR)/pmrepconf
$(INSTALL) -S $(DISTARGET) $(PCP_BINADM_DIR)/$(CMDTARGET)
$(INSTALL) -m 755 zeroconf.pmcheck $(PCP_SHARE_DIR)/lib/pmcheck/zeroconf
$(INSTALL) -m 755 $(PMCHECK) $(PCP_SHARE_DIR)/lib/pmcheck/zeroconf

default_pcp : default

Expand Down
31 changes: 31 additions & 0 deletions src/pmlogconf/no.zeroconf.pmcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
#
# zeroconf "plugin" for pmcheck ...
# this version is for distros/platforms/builds where the pcp-zeroconf
# package is not available (currently anything other than Linux)
#

. $PCP_DIR/etc/pcp.env || exit 1
. $PCP_SHARE_DIR/lib/checkproc.sh

_do_args "$@"

na="not currently available for `uname -s`"

if $lflag
then
[ "$verbose" -gt 0 ] && echo "PCP Zeroconf Package - $na"
elif $sflag
then
status=2
[ "$verbose" -gt 0 ] && echo "pcp-zeroconf package $na"
elif $aflag || $dflag
then
status=1
[ "$verbose" -gt 0 ] && echo "pcp-zeroconf package $na"
else
[ $verbose -gt 0 ] && echo "botch sflag=$sflag aflag=$aflag dflag=$dflag show_me=$show_me verbose=$verbose"
status=99
fi

exit

0 comments on commit c69d3af

Please sign in to comment.