Index: net-mgmt/postfix_exporter/Makefile =================================================================== --- net-mgmt/postfix_exporter/Makefile +++ net-mgmt/postfix_exporter/Makefile @@ -0,0 +1,40 @@ +# $FreeBSD$ + +PORTNAME= postfix_exporter +DISTVERSION= 0.1.2 +CATEGORIES= net-mgmt + +MAINTAINER= fabian.freyer@physik.tu-berlin.de +COMMENT= Postfix Exporter for Prometheus + +LICENSE= APACHE20 + +USES= go +USE_GITHUB= yes +GH_ACCOUNT= kumina +GH_TUPLE+= prometheus:client_golang:v0.8.0:prometheus_client/../src/github.com/prometheus/client_golang +GH_TUPLE+= golang:protobuf:v1.1.0:protobuf/../src/github.com/golang/protobuf +GH_TUPLE+= beorn7:perks:3a771d992973f24aa725d07868b467d1ddfceafb:quantile/../src/github.com/beorn7/perks +GH_TUPLE+= prometheus:client_model:5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f:prometheus_client_model/../src/github.com/prometheus/client_model +GH_TUPLE+= prometheus:common:7600349dcfe1abd18d72d3a1770870d9800a7801:prometheus_common/../src/github.com/prometheus/common +GH_TUPLE+= prometheus:procfs:ae68e2d4c00fed4943b5f6698d504a5fe083da8a:prometheus_procfs/../src/github.com/prometheus/procfs +GH_TUPLE+= matttproud:golang_protobuf_extensions:v1.0.1:pbutil/../src/github.com/matttproud/golang_protobuf_extensions + +USE_RC_SUBR= postfix_exporter +USERS= prometheus +GROUPS= prometheus +GO_PKGNAME= github.com/kumina/${PORTNAME} +GO_TARGET= github.com/kumina/${PORTNAME} + +PLIST_FILES= bin/postfix_exporter + +post-extract: + ${MKDIR} ${GO_WRKSRC:H} + ${LN} -sf ${WRKSRC} ${GO_WRKSRC} + ${MKDIR} ${GO_WRKDIR_SRC}/code.google.com/p/ + ${LN} -sf ${GO_WRKDIR_SRC}/github.com/golang/protobuf ${GO_WRKDIR_SRC}/code.google.com/p/goprotobuf + +do-build: + (cd ${GO_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} install -tags nosystemd -v ${GO_TARGET}) + +.include Index: net-mgmt/postfix_exporter/distinfo =================================================================== --- net-mgmt/postfix_exporter/distinfo +++ net-mgmt/postfix_exporter/distinfo @@ -0,0 +1,17 @@ +TIMESTAMP = 1532370118 +SHA256 (kumina-postfix_exporter-0.1.2_GH0.tar.gz) = 88562bd16631f3b09e3cbe791c814c3c2302b0f97deeb717c7c7ab09be01826e +SIZE (kumina-postfix_exporter-0.1.2_GH0.tar.gz) = 11552 +SHA256 (prometheus-client_golang-v0.8.0_GH0.tar.gz) = 88b0040393276116f848de5bdd636717d339667273cfc45a4edda40b5e5682bd +SIZE (prometheus-client_golang-v0.8.0_GH0.tar.gz) = 75593 +SHA256 (golang-protobuf-v1.1.0_GH0.tar.gz) = c086490e7b116b73b7e3e6058eae997576d0523ad8f1b2ec2b698887e62b14a8 +SIZE (golang-protobuf-v1.1.0_GH0.tar.gz) = 324733 +SHA256 (beorn7-perks-3a771d992973f24aa725d07868b467d1ddfceafb_GH0.tar.gz) = 9edc7a840112708d6a826c99eb46c1b91aec2faeac2c707fc89faa77af8fda06 +SIZE (beorn7-perks-3a771d992973f24aa725d07868b467d1ddfceafb_GH0.tar.gz) = 10800 +SHA256 (prometheus-client_model-5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f_GH0.tar.gz) = a386eaae72fba4f3abf561bdacc88125ef5179716ec06917a39eb3102ca68d51 +SIZE (prometheus-client_model-5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f_GH0.tar.gz) = 57195 +SHA256 (prometheus-common-7600349dcfe1abd18d72d3a1770870d9800a7801_GH0.tar.gz) = 7f9b19519e2f3f86b0e1b32630187ec48e4dadf2d362fd41dd1bbeec2aaebcbe +SIZE (prometheus-common-7600349dcfe1abd18d72d3a1770870d9800a7801_GH0.tar.gz) = 77798 +SHA256 (prometheus-procfs-ae68e2d4c00fed4943b5f6698d504a5fe083da8a_GH0.tar.gz) = db93c0748fd95d1006aec3620dd03055f655f24daea8c6635a84c3b0699cc25c +SIZE (prometheus-procfs-ae68e2d4c00fed4943b5f6698d504a5fe083da8a_GH0.tar.gz) = 57831 +SHA256 (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 2def0ee6f6b12b1efc0e3007d89f598608a072610e805c3655ea9d13c3ead49b +SIZE (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 37184 Index: net-mgmt/postfix_exporter/files/pkg-message.in =================================================================== --- net-mgmt/postfix_exporter/files/pkg-message.in +++ net-mgmt/postfix_exporter/files/pkg-message.in @@ -0,0 +1,22 @@ +The postfix_exporter can monitor a postfix log file. This should NOT +be the system-wide maillog, as the exporter will repeatedly truncate +the file. To configure syslogd to additionally log maillog messages +to the default postfix_exporter input logfile, add the following +line to /etc/syslog.conf: + + mail.info /var/log/postfix_exporter_input.log + +The postfix_exporter will need to have permissions to read and write +this file: + + touch /var/log/postfix_exporter_input.log + chown prometheus:prometheus /var/log/postfix_exporter_input.log + +The postfix_exporer can monitor the postfix showq socket. To allow the +postfix_exporter to access this socket, add the prometheus user to the +maildrop group: + + pw usermod prometheus -G maildrop + +To run postfix_exporter, set the postfix_exporter_enable="YES" +rcvar and point your prometheus instance at port 9154. Index: net-mgmt/postfix_exporter/files/postfix_exporter.in =================================================================== --- net-mgmt/postfix_exporter/files/postfix_exporter.in +++ net-mgmt/postfix_exporter/files/postfix_exporter.in @@ -0,0 +1,69 @@ +#!/bin/sh + +# $FreeBSD$ + +# PROVIDE: postfix_exporter +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# postfix_exporter_enable (bool): Set to NO by default. +# Set it to YES to enable postfix_exporter. +# postfix_exporter_user (string): Set user that postfix_exporter will +# run under +# Default is "prometheus". +# postfix_exporter_group (string): Set group that postfix_exporter will +# run under +# Default is "prometheus". +# postfix_exporter_listen_address (string):Set ip:port that postfix_exporter +# will listen on +# Default is ":9154". +# postfix_exporter_showq_path (string): Path at which Postfix places its +# showq socket +# Default is "/var/spool/postfix/public/showq" +# postfix_exporter_logfile_path (string): Path at which Postfix writes log +# entries. This file will be truncated +# by this exporter. +# Default is "/var/log/postfix_exporter_input.log". +# postfix_exporter_args (string) Additional command line parameters to +# be passed to postfix_exporter +# Default is "" + +. /etc/rc.subr + +name=postfix_exporter +desc="Postfix exporter for use with prometheus" +rcvar=postfix_exporter_enable + +load_rc_config $name + +: ${postfix_exporter_enable:=NO} +: ${postfix_exporter_user:=prometheus} +: ${postfix_exporter_group:=prometheus} +: ${postfix_exporter_listen_address=:9154} +: ${postfix_exporter_showq_path=/var/spool/postfix/public/showq} +: ${postfix_exporter_logfile_path=/var/log/postfix_exporter_input.log} + +pidfile=/var/run/postfix_exporter.pid +command=/usr/sbin/daemon +procname="%%PREFIX%%/bin/postfix_exporter" +command_args="-p ${pidfile} -T ${name}/usr/bin/env ${procname} \ + --web.listen-address=${postfix_exporter_listen_address} \ + --postfix.showq_path="${postfix_exporter_showq_path}" \ + --postfix.logfile_path="${postfix_exporter_logfile_path}" \ + ${postfix_exporter_args}" + +start_precmd=postfix_exporter_startprecmd + +postfix_exporter_startprecmd() +{ + if [ ! -e ${pidfile} ]; then + install -o ${postfix_exporter_user} -g ${postfix_exporter_group} /dev/null ${pidfile}; + else + chown ${postfix_exporter_user}:${postfix_exporter_group} ${pidfile}; + fi +} + +run_rc_command "$1" Index: net-mgmt/postfix_exporter/pkg-descr =================================================================== --- net-mgmt/postfix_exporter/pkg-descr +++ net-mgmt/postfix_exporter/pkg-descr @@ -0,0 +1,5 @@ +postfix_exporter is a prometheus exporter for the postfix mail server. +This exporter provieds histogram metrics for the size and age of messages +stored in the mail queue as well as event counts. + +WWW: https://github.com/kumina/postfix_exporter