Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD support #83

Open
Schueni1 opened this issue Oct 10, 2021 · 2 comments
Open

FreeBSD support #83

Schueni1 opened this issue Oct 10, 2021 · 2 comments

Comments

@Schueni1
Copy link

Does this work under FreeBSD? I could not find it in https://www.freshports.org/

@Subito
Copy link

Subito commented Feb 22, 2022

Yes, as far as I can tell it compiles and runs fine on FreeBSD. A Port is missing so far, but a simple go get github.com/kumina/postfix_exporter should get you started.

@sgohl
Copy link

sgohl commented Jul 4, 2023

just confirming it works on FreeBSD with the binary copied from another FreeBSD system where I installed pkg install go and run go install github.com/kumina/postfix_exporter@latest so the actual target system does not need to have go installed.

./postfix_exporter --postfix.logfile_path="/var/log/maillog"

I've stolen the rc-script for /usr/local/etc/rc.d/postfix_exporter from node_exporter:

#!/bin/sh

# 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 "nobody".
# postfix_exporter_group (string):         Set group that postfix_exporter will run under
#               Default is "nobody".
# postfix_exporter_args (string):          Set extra arguments to pass to postfix_exporter
#               Default is "".
# postfix_exporter_listen_address (string):Set ip:port that postfix_exporter will listen on
#               Default is ":9154".
# postfix_exporter_textfile_dir (string):  Set directory that postfix_exporter will watch
#               Default is "/var/tmp/postfix_exporter".

. /etc/rc.subr

name=postfix_exporter
rcvar=postfix_exporter_enable

load_rc_config $name

: ${postfix_exporter_enable:="NO"}
: ${postfix_exporter_user:="root"}
: ${postfix_exporter_group:="postfix"}
: ${postfix_exporter_listen_address:=":9154"}
: ${postfix_exporter_textfile_dir:="/var/tmp/postfix_exporter"}
: ${postfix_exporter_logfile_path:="/var/log/maillog"}

pidfile=/var/run/postfix_exporter.pid
command="/usr/sbin/daemon"
procname="/usr/local/bin/postfix_exporter"
command_args="-f -p ${pidfile} -T ${name} \
    /usr/bin/env ${procname} \
    --postfix.logfile_path=${postfix_exporter_logfile_path} \
    --web.listen-address=${postfix_exporter_listen_address}"

start_precmd=postfix_exporter_startprecmd

postfix_exporter_startprecmd()
{
    if [ ! -e ${pidfile} ]; then
        install \
            -o ${postfix_exporter_user} \
            -g ${postfix_exporter_group} \
            /dev/null ${pidfile};
    fi
}

load_rc_config $name
run_rc_command "$1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants