#!/sbin/openrc-run

name=metricbeat
description="MetricBeat - Lightweight shipper for system and service statistics"
command=/usr/bin/metricbeat
command_args="$metricbeat_opts"
command_background=true
pidfile=/run/${RC_SVCNAME}.pid
output_log=/var/log/${RC_SVCNAME}.log
error_log=/var/log/${RC_SVCNAME}.log

extra_commands="checkconfig"
description_checkconfig="Verify configuration file"

start_pre() {
	checkpath -f -m 0644 "$output_log"
}

depend() {
	need net
	after firewall
}

checkconfig() {
	$command test config -c /etc/metricbeat/metricbeat.yml
}

start_pre() {
	ebegin "checking configuration"
	checkconfig
}
