#!/bin/sh # $FreeBSD: head/net/postfix_exporter/files/postfix_exporter.in 529909 2020-03-30 19:18:03Z decke $ # # PROVIDE: postfix_exporter # REQUIRE: DAEMON # KEYWORD: shutdown # # postfix_exporter_enable (bool): Set to "YES" to enable postfix_exporter. # (default: "NO") # # postfix_exporter_postfix_logfile (str): File where Postfix writes log entries. # Will be truncated by the exporter. # (default: "/var/log/maillog") # postfix_exporter_showq (str): Showq socket path # (default: "/var/spool/postfix/public/showq") # postfix_exporter_listen (str): Exporter listening address # (default: ":9154") # postfix_exporter_telemetry_path (str): Path under which to expose metrics # (default: "/metrics") # postfix_exporter_logfile (str): Postfix_exporter logfile # (default: "/var/log/postfix_exporter.log") # . /etc/rc.subr name=postfix_exporter rcvar=postfix_exporter_enable load_rc_config $name : ${postfix_exporter_enable="NO"} : ${postfix_exporter_postfix_logfile="/var/log/maillog"} : ${postfix_exporter_showq="/var/spool/postfix/public/showq"} : ${postfix_exporter_listen=":9154"} : ${postfix_exporter_telemetry_path="/metrics"} : ${postfix_exporter_pidfile:="/var/run/postfix_exporter.pid"} : ${postfix_exporter_user:="prometheus"} : ${postfix_exporter_logfile="/var/log/postfix_exporter.log"} command="/usr/local/bin/postfix_exporter" command_args="--web.listen-address=\${postfix_exporter_listen} --web.telemetry-path=\${postfix_exporter_telemetry_path} --postfix.showq_path=\${postfix_exporter_showq} --postfix.logfile_path=\${postfix_exporter_postfix_logfile} > ${postfix_exporter_logfile} 2>&1" start_cmd="/usr/sbin/daemon -u ${postfix_exporter_user} ${command} ${command_args}" run_rc_command "$1"