diff --git a/sysutils/node_exporter/Makefile b/sysutils/node_exporter/Makefile index 1374d8569111..d1fa0b85bfab 100644 --- a/sysutils/node_exporter/Makefile +++ b/sysutils/node_exporter/Makefile @@ -4,24 +4,34 @@ PORTNAME= node_exporter PORTVERSION= 0.17.0 DISTVERSIONPREFIX=v +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= ports@ecadlabs.com COMMENT= Prometheus exporter for machine metrics LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE -USES= go +TEST_DEPENDS= promtool:net-mgmt/prometheus2 \ + bash:shells/bash \ + gsed:textproc/gsed + +USES= gmake go shebangfix USE_GITHUB= yes - GH_ACCOUNT= prometheus +USE_RC_SUBR= node_exporter + +# The ttar script is used to run the tests. +SHEBANG_FILES= ttar GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME} GO_TARGET= github.com/${GH_ACCOUNT}/${PORTNAME} -PLIST_FILES= bin/node_exporter +# A "checkrules" target is being added in >0.17.0. +TEST_TARGET= test -USE_RC_SUBR= node_exporter +TEST_ENV= PROMTOOL=${LOCALBASE}/bin/promtool BUILD_USER?= ${USER} LD_FLAG_X_PREFIX= -X ${GO_PKGNAME}/vendor/${GO_PKGNAME:H}/common/version @@ -32,7 +42,38 @@ LD_FLAG_STRING= -s \ ${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER} GO_BUILDFLAGS= -v -ldflags "${LD_FLAG_STRING}" +OPTIONS_DEFINE= DOCS EXAMPLES + do-install: ${INSTALL_PROGRAM} ${WRKDIR}/bin/node_exporter ${STAGEDIR}${PREFIX}/bin +post-install-DOCS-on: + ${MKDIR} ${STAGEDIR}${DOCSDIR} + cd ${WRKSRC}/docs && \ + ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} + +post-install-EXAMPLES-on: + ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/text_collector_examples + cd ${WRKSRC} && ${COPYTREE_SHARE} ./text_collector_examples ${STAGEDIR}${EXAMPLESDIR} + +# TestFileDescriptorLeak is being skipped at the moment because procfs(5) is +# not properly detected. +pre-test: + # Prevent Go from attempting to use Git to redownload its dependencies. + # They are already present in ${WRKSRC}/vendor. + ${RM} ${WRKSRC}/go.mod + + ${REINPLACE_CMD} -e 's|sed|${LOCALBASE}/bin/gsed|g' ${WRKSRC}/ttar + + ${RM} -r ${WRKDIR}/src + ${LN} -sf ${WRKSRC}/vendor ${WRKDIR}/src + ${MKDIR} ${WRKSRC}/vendor/${GO_PKGNAME} + ${LN} -sf ${WRKSRC}/collector ${WRKSRC}/vendor/${GO_PKGNAME}/collector + + # GOPATH has to have exactly one element in order to have the test + # suite detect the node_exporter binary. "-v" is added here for us to + # see skipped tests. + ${REINPLACE_CMD} -E 's|(\$$\(GO\) test)|env GOPATH="${WRKDIR}" \1 -v|g' ${WRKSRC}/Makefile + .include diff --git a/sysutils/node_exporter/pkg-descr b/sysutils/node_exporter/pkg-descr index d1a65ce135ab..fddcd1967e2c 100644 --- a/sysutils/node_exporter/pkg-descr +++ b/sysutils/node_exporter/pkg-descr @@ -1,4 +1,4 @@ -node_exporter is a prometheus exporter for machine metrics, written in Go -with pluggable metric collectors. +Node exporter is a Prometheus exporter for hardware and OS metrics, written in +Go with pluggable metric collectors. WWW: https://github.com/prometheus/node_exporter diff --git a/sysutils/node_exporter/pkg-plist b/sysutils/node_exporter/pkg-plist new file mode 100644 index 000000000000..0764205e0d58 --- /dev/null +++ b/sysutils/node_exporter/pkg-plist @@ -0,0 +1,17 @@ +bin/node_exporter +%%PORTDOCS%%%%DOCSDIR%%/README.md +%%PORTDOCS%%%%DOCSDIR%%/TIME.md +%%PORTDOCS%%%%DOCSDIR%%/V0_16_UPGRADE_GUIDE.md +%%PORTDOCS%%%%DOCSDIR%%/example-16-compatibility-rules-new-to-old.yml +%%PORTDOCS%%%%DOCSDIR%%/example-16-compatibility-rules.yml +%%PORTDOCS%%%%DOCSDIR%%/example-17-compatibility-rules-new-to-old.yml +%%PORTDOCS%%%%DOCSDIR%%/example-17-compatibility-rules.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/README.md +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/apt.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/deleted_libraries.py +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/directory-size.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/ipmitool +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/md_info.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/ntpd_metrics.py +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/smartmon.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/storcli.py