1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-05 06:27:37 +00:00

net-mgmt/icingadb: Add new port

Publish, synchronize, and visualize Icinga data

https://icinga.com/docs/icinga-db/latest/doc/02-Installation/
This commit is contained in:
Dan Langille 2023-09-26 15:19:52 +00:00
parent 0b95badb08
commit 67e1373470
7 changed files with 141 additions and 0 deletions

View File

@ -87,6 +87,7 @@
SUBDIR += icinga-php-library
SUBDIR += icinga-php-thirdparty
SUBDIR += icinga2
SUBDIR += icingadb
SUBDIR += icingaweb2
SUBDIR += icingaweb2-module-businessprocess
SUBDIR += icingaweb2-module-cube

View File

@ -0,0 +1,48 @@
PORTNAME= icingadb
DISTVERSIONPREFIX= v
DISTVERSION= 1.1.1
PORTREVISION= 5
CATEGORIES= net-mgmt
MAINTAINER= dvl@FreeBSD.org
COMMENT= Publish, synchronize, and visualize Icinga data
WWW= https://icinga.com/docs/icinga-db/latest/doc/02-Installation/
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go:modules
USE_RC_SUBR= icingadb
PLIST_SUB= PORTNAME=${PORTNAME}
# As copied from net-mgmt/icinga2
ICINGA2USER?= icinga
ICINGA2GROUP?= icinga
USERS= ${ICINGA2USER}
GROUPS= ${ICINGA2GROUP}
SUB_LIST= ICINGA2GROUP=${ICINGA2GROUP} \
ICINGA2USER=${ICINGA2USER}
USE_GITHUB= yes
GH_ACCOUNT= Icinga
GH_PROJECT= icingadb
GO_MODULE= github.com/icinga/icingadb
GO_TARGET= ./cmd/icingadb
SUB_LIST+= ICINGA2USER=${ICINGA2USER} \
PREFIX=${PREFIX}
post-patch:
@${REINPLACE_CMD} -e 's|%%PREFIX|${PREFIX}|g' ${WRKSRC}/pkg/config/config.go
post-install:
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
${MKDIR} ${STAGEDIR}${ETCDIR}
(cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
${INSTALL_DATA} ${WRKSRC}/config.example.yml ${STAGEDIR}${ETCDIR}/config.yml.sample
.include <bsd.port.mk>

View File

@ -0,0 +1,7 @@
TIMESTAMP = 1694197114
SHA256 (go/net-mgmt_icingadb/Icinga-icingadb-v1.1.1_GH0/v1.1.1.mod) = a1c31eb3ce2da460c847b048f5020a1707273df2d46169f37511de4cee9b5685
SIZE (go/net-mgmt_icingadb/Icinga-icingadb-v1.1.1_GH0/v1.1.1.mod) = 1508
SHA256 (go/net-mgmt_icingadb/Icinga-icingadb-v1.1.1_GH0/v1.1.1.zip) = 7988ae8a59b5904a461b922bb50d35c9e1ebd5e659486d40425f01594fc2a21c
SIZE (go/net-mgmt_icingadb/Icinga-icingadb-v1.1.1_GH0/v1.1.1.zip) = 3872935
SHA256 (go/net-mgmt_icingadb/Icinga-icingadb-v1.1.1_GH0/Icinga-icingadb-v1.1.1_GH0.tar.gz) = 8f4246765dc364917170905e38b01c62a6c44eab7d333c131fc46691a47c150a
SIZE (go/net-mgmt_icingadb/Icinga-icingadb-v1.1.1_GH0/Icinga-icingadb-v1.1.1_GH0.tar.gz) = 3868785

View File

@ -0,0 +1,55 @@
#!/bin/sh
# PROVIDE: icingadb
# REQUIRE: SERVERS mysql postgresql
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# icingadb_enable: Set to NO by default.
# Set it to YES to enable icingadb
# icingadb_user: The user account used to run the daemon.
# Default: %%ICINGA2USER%%
# icingadb_group: The group account used to run the daemon.
# Default: %%ICINGA2GROUP%%
#
. /etc/rc.subr
name=icingadb
rcvar="${name}_enable"
load_rc_config $name
: ${icingadb_enable:="NO"}
: ${icingadb_user:="%%ICINGA2USER%%"}
: ${icingadb_group:="%%ICINGA2GROUP%%"}
icingadb_pid="/var/run/icingadb/icingadb.pid"
icingadb_logfile="/var/log/icinga2/$name.log"
icingadb_daemonflags="-o ${icingadb_logfile}"
pidfile="$icingadb_pid"
command="/usr/sbin/daemon"
start_precmd=icingadb_precmd
icingadb_precmd()
{
[ -f ${icingadb_logfile} ] || install -g $icingadb_group -o $icingadb_user -m 644 /dev/null ${icingadb_logfile}
if [ ! -d "/var/run/icingadb" ]; then
install -d -o ${icingadb_user} -g ${icingadb_group} -m 0775 "/var/run/icingadb"
fi
if [ ! -e ${pidfile} ]; then
install -o ${icingadb_user} -g ${icingadb_group} /dev/null ${pidfile};
else
chown ${icingadb_user}:${icingadb_group} ${pidfile};
fi
}
command_args="$icingadb_daemonflags -P $pidfile -t ${name} -T ${name} %%PREFIX%%/bin/$name -c %%PREFIX%%/etc/icingadb/config.yml"
run_rc_command "$1"

View File

@ -0,0 +1,11 @@
--- pkg/config/config.go.orig 2023-09-08 17:19:58 UTC
+++ pkg/config/config.go
@@ -46,7 +46,7 @@ type Flags struct {
// Version decides whether to just print the version and exit.
Version bool `long:"version" description:"print version and exit"`
// Config is the path to the config file
- Config string `short:"c" long:"config" description:"path to config file" required:"true" default:"/etc/icingadb/config.yml"`
+ Config string `short:"c" long:"config" description:"path to config file" required:"true" default:"%%PREFIX%%/etc/icinga2/icingadb.yml"`
}
// FromYAMLFile returns a new Config value created from the given YAML config file.

View File

@ -0,0 +1,11 @@
Icinga DB is a set of components for publishing, synchronizing and visualizing
monitoring data in the Icinga ecosystem, consisting of:
* Icinga DB Web which connects to both a Redis server and a database to view and
work with most up-to-date monitoring data
* Icinga 2 with its Icinga DB feature enabled, responsible for publishing the
data to the Redis server, i.e. configuration and its runtime updates, check
results, state changes, downtimes, acknowledgements, notifications, and other
events such as flapping
* And the Icinga DB daemon, which synchronizes the data between the Redis server
and the database

View File

@ -0,0 +1,8 @@
bin/%%PORTNAME%%
@sample(root,wheel,0640) etc/%%PORTNAME%%/config.yml.sample
%%EXAMPLESDIR%%/schema/pgsql/upgrades/1.1.1.sql
%%EXAMPLESDIR%%/schema/pgsql/schema.sql
%%EXAMPLESDIR%%/schema/mysql/schema.sql
%%EXAMPLESDIR%%/schema/mysql/upgrades/1.1.1.sql
%%EXAMPLESDIR%%/schema/mysql/upgrades/1.0.0.sql
%%EXAMPLESDIR%%/schema/mysql/upgrades/1.0.0-rc2.sql