Improve pgmon ebuild

This commit is contained in:
James Campbell 2024-06-03 01:13:17 -04:00
parent 1ccb378461
commit 20321eba52
Signed by: james
GPG Key ID: 2287C33A40DC906A
5 changed files with 146 additions and 1 deletions

View File

@ -1 +1,4 @@
EBUILD pgmon-0.0.1.ebuild 424 SHA256 6a6cca84d8d6d9f5179fab7078c0585b31ef56e5f4bc6009ea289083de66ef25 SHA512 615672e3d095bd9f3a89dbc8fde99628a65c46f1683538e775def6a649ce3b8eac0d173417957257472f02b5e3e7af8cbdba935a681293d6ccff93dcac429b56 WHIRLPOOL e1462ad21a3ff76017dbdd2ba913b9b1ec52e8f498f8d0079166deae212e7079665bd7b65a5816e322e3280955264a647eaf04a19c5fbf3c41321ebc6f2adb41 AUX pgmon.cfg 1168 SHA256 22056b7a84e850d5c5910e02bfc8d847472253d510956880b4eda9cbd3d2b572 SHA512 61451aebd624ff0d693e840bde149c9f4bd496c4bb2f046a6767da9ec20db47a7d0edd4c7441634f9783d878ff670ab2d56e4ff959352b20e1a93a838e68d43b WHIRLPOOL d181e28609ee9500af1a98b8bd97eed4a5cb4baf5c142d1ce595cbf6e854995d1b7e59a847cc3adac06248f88556a4be21762344ff402933daaf77414c1b211c
AUX pgmon.logrotate 116 SHA256 d7cc697cc640f661ec0019363b8a411e0df62cbe63b97c5fca0ad4f533803154 SHA512 50cb5530a36cff24d0ba7c19b1aa05862f7aa3e82ccd6a9e7029a53e00c579dbb9eb310210508ad9c8b26a8462c038519230edd1d0295c6b73fab269357c57c7 WHIRLPOOL 043e68161bb9056e5c0eb9bdc883f181d4f43d45b3dd9eaffd20e94fad48072762d29e18124489c5ce7229f62fb9763335c5908509c0a2d552061cc6f56ee8d5
AUX pgmon.openrc 546 SHA256 e83d8b69a11dbdd4deb4d7b67c1460d15c1b4f745cac006c38a41b05e9ba246b SHA512 69e9402e240129276c16e9b9c30bf22984bd70e48c930523383952db6bf7309f1c4b51109036a45966de69a8e9bd9462060e84d25cf67b3fd334bbed73bdb183 WHIRLPOOL 132313fda595648e9f2610042e19056528a2109f2a731f92fd3fa7f0f9a8a91dc110ee90f06252ad3f5bb89c71cd554ec8897014fc09e8ab9b3a6e0a9a70591b
EBUILD pgmon-0.0.1.ebuild 1405 SHA256 43de820c58ecdc486ab305910e0b2db269d9b7fd768535503f87fe860665222c SHA512 97fac5da0a9cf1ee6a9e14bcbfbbdd248f0bca9889006fb669cd41352ec084f28c04d47fa4a8a2aacc34f3d2556179ae9b2e518f081942fc88e68e99c32a5512 WHIRLPOOL 255b7cd73046bd66e2a4878626ce263feb9a07f0fb3693f2403230ecc1178511b659716cdbe29f8557104858038d6cfc3c7147d56dfbd2785d6f8f1790c10bd1

View File

@ -0,0 +1,70 @@
##
# Misc agent settings
##
# Where to write/find the agent PID
#pid_file=/tmt/pgmon.pid
pid_file=/run/pgmon/pgmon.pid
##
# Agent communication settings
##
# IPC socket
#ipc_socket=/tmp/pgmon.sock
ipc_socket=/run/pgmon/pgmon.sock
# IPC communication timeout (s)
#ipc_timeout=10
# Request processing timeout (s)
#request_timeout=10
# Max size of the request queue before it blocks
#request_queue_size=100
# Max time to wait when queueing a request (s)
#request_queue_timeout=2
##
# Agent resource settings
##
# Number of worker threads
#worker_count=4
##
# Logging settings
##
# Log level for stderr logging (or 'off')
stderr_log_level=info
# Log level for file logging (od 'off')
file_log_level=notice
# Log file
#log_file=pgmon.log
##
# DB connection settings
#
# Each cluster entry is of the form:
# name:address:port:dbname:user:password
#
# Any element other than the name can be left empty to use the defaults
##
#cluster=local:/var/run/postgresql:5432:postgres:zbx_monitor:
# Default database to connect to when none is specified for a metric
#dbname=postgres
##
# Monitoring configuration
##
# Metrics
#metrics={}
include=pgmon-metrics.cfg

View File

@ -0,0 +1,10 @@
/var/log/pgmon/*.log {
daily
missingok
rotate 7
compress
delaycompress
copytruncate
notifempty
maxsize 1G
}

View File

@ -0,0 +1,23 @@
#!/sbin/openrc-run
extra_started_commands="reload"
agent_name=${RC_SERVICE#pgmon.}
agent_name=${agent_name:-pgmon}
command="/usr/local/bin/pgmon"
command_args="--server --config /etc/pgmon/${agent_name}.cfg"
command_user="zabbix:zabbix"
pidfile="/run/pgmon/${agent_name}.pid"
start_pre() {
checkpath -d -m 0755 -o "${command_user}" "/run/pgmon"
checkpath -d -m 0755 -o "${command_user}" "/var/log/pgmon"
}
reload() {
ebegin "Reloading ${RC_SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}

View File

@ -17,9 +17,48 @@ KEYWORDS="amd64"
EGIT_REPO_URL="https://code2.shh-dot-com.org/pgmon.git" EGIT_REPO_URL="https://code2.shh-dot-com.org/pgmon.git"
#EGIT_COMMIT="" #EGIT_COMMIT=""
IUSE="+agent agent2"
DEPEND=" DEPEND="
${PYTHON_DEPS} ${PYTHON_DEPS}
dev-python/psycopg:2 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}" RDEPEND="${DEPEND}"
BDEPEND="" BDEPEND=""
src_install() {
default
# Install init script
newinitd files/pgmon.openrc 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
}