diff options
author | Mikael Urankar <mikael@FreeBSD.org> | 2020-10-27 18:06:25 +0000 |
---|---|---|
committer | Mikael Urankar <mikael@FreeBSD.org> | 2020-10-27 18:06:25 +0000 |
commit | 7f72e9498d8ffea39b48cbb1b5a1b17fb90252ed (patch) | |
tree | a230277354a81e4bc4818f3579c9720da16632a9 /net-mgmt/bosun/files | |
parent | 05bc059f79c00a07925846e5222e188cc4f236fb (diff) | |
download | ports-7f72e9498d8ffea39b48cbb1b5a1b17fb90252ed.tar.gz ports-7f72e9498d8ffea39b48cbb1b5a1b17fb90252ed.zip |
net-mgmt/bosun: create port
Bosun is an open-source, MIT licensed, monitoring and alerting system by
Stack Exchange.
It has an expressive domain specific language for evaluating alerts
and creating detailed notifications.
It also lets you test your alerts against history
for a faster development experience.
WWW: https://bosun.org/
PR: 250209
Submitted by: Markus Langer <langer.markus@gmail.com>
Notes
Notes:
svn path=/head/; revision=553462
Diffstat (limited to 'net-mgmt/bosun/files')
-rw-r--r-- | net-mgmt/bosun/files/bosun.in | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/net-mgmt/bosun/files/bosun.in b/net-mgmt/bosun/files/bosun.in new file mode 100644 index 000000000000..f26039d593f4 --- /dev/null +++ b/net-mgmt/bosun/files/bosun.in @@ -0,0 +1,69 @@ +#!/bin/sh +# $FreeBSD: head/net-mgmt/bosun/files/bosun.in 528773 2020-03-20 11:58:01Z girgen $ + +# PROVIDE: bosun +# REQUIRE: DAEMON NETWORKING +# BEFORE: LOGIN +# KEYWORD: shutdown + +# Add the following lines to /etc/rc.conf to enable bosunb: +# bosun_enable="YES" +# +# bosun_enable (bool): Set to YES to enable bosun +# Default: NO +# bosun_conf (str): bosun configuration file +# Default: %%ETCDIR%%/${name}.conf +# bosun_user (str): bosun daemon user +# Default: %%USERS%% +# bosun_group (str): bosun daemon group +# Default: %%GROUPS%% +# bosun_flags (str): Extra flags passed to bosun +# Default: empty + +. /etc/rc.subr + +PATH=${PATH}:%%LOCALBASE%%/sbin:%%LOCALBASE%%/bin + +name="bosun" +rcvar=bosun_enable +load_rc_config $name + +: ${bosun_enable:="NO"} +: ${bosun_user:="%%USERS%%"} +: ${bosun_group:="%%GROUPS%%"} +: ${bosun_conf:="%%ETCDIR%%/${name}.conf"} +: ${bosun_flags}:="" +: ${bosun_options:="${bosun_flags} -c ${bosun_conf}"} + +logfile="%%BOSUN_LOGDIR%%/${name}.log" +pidfile="/var/run/${name}.pid" +command=/usr/sbin/daemon +start_precmd="bosun_prestart" +start_cmd="bosun_start" +stop_cmd="bosun_stop" + +bosun_prestart() +{ + install -d -o ${bosun_user} -g ${bosun_group} -m750 %%BOSUN_LOGDIR%% +} + +bosun_start() +{ + echo "Starting ${name}" + /usr/sbin/daemon -fcr -P ${pidfile} -u ${bosun_user} -o ${logfile} \ + %%PREFIX%%/bin/${name} ${bosun_options} +} + +bosun_stop() +{ + pid=$(check_pidfile $pidfile $command) + if [ -n "${pid}" ]; then + echo "Stopping ${name} (pid=${pid})" + kill -- -${pid} + wait_for_pids ${pid} + else + echo "${name} isn't running" + fi +} + +run_rc_command "$1" |