jtc-overlay/dev-db/pgmon/pgmon-0.0.1.ebuild

68 lines
1.4 KiB
Bash

# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{6..11} )
inherit git-r3 python-r1
DESCRIPTION="PostgreSQL monitoring bridge"
HOMEPAGE="None"
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64"
EGIT_REPO_URI="https://code2.shh-dot-com.org/james/pgmon.git"
#EGIT_COMMIT=""
IUSE="+agent agent2"
DEPEND="
${PYTHON_DEPS}
dev-python/psycopg:2
acct-user/zabbix
acct-group/zabbix
agent? ( net-analyzer/zabbix[agent] )
agent2? ( net-analyzer/zabbix[agent2] )
app-admin/logrotate
"
RDEPEND="${DEPEND}"
BDEPEND=""
src_install() {
default
# Install init script
newinitd "${FILESDIR}/pgmon.openrc" pgmon
# Install script
newexe "${S}/pgmon.py" pgmon
# Install default config
diropts -o root -g zabbix -m 0755
insinto /etc/pgmon
doins "${FILESDIR}/pgmon.cfg"
doins "${S}/pgmon-metrics.cfg"
# Install Zabbix userparams file
if use agent; then
insinto /etc/zabbix/zabbix_agent.d
newins "${S}/pgmon_userparameter.conf" pgmon.conf
fperms 0644 /etc/zabbix/zabbix_agent.d/pgmon.conf
fowners root:zabbix /etc/zabbix/zabbix_agent.d/pgmon.conf
fi
if use agent2; then
insinto /etc/zabbix/zabbix_agent2.d
newins "${S}/pgmon_userparameter.conf" pgmon.conf
fperms 0644 /etc/zabbix/zabbix_agent2.d/pgmon.conf
fowners root:zabbix /etc/zabbix/zabbix_agent2.d/pgmon.conf
fi
# Install logrotate config
insinto /etc/logrotate.d
newins "${FILESDIR}/pgmon.logrotate" pgmon
}