From: Harrison Carter hcarter@thegoodpenguin.co.uk
This patch series adds a basic zabbix server, frontend, and agent for a morello distro
Harrison Marcks (5): zabbix-agentd: re-add systemd config kas: add fstype tar.bz2 postgresql: fix file dominion cyrus-sasl: add missing group for zabbix-server zabbix-server: add init script for zabbix DB
kas/morello-linux-debug.yml | 2 + .../zabbix/files/zabbix-agentd.conf | 4 +- ...-morello.service => zabbix-agentd.service} | 0 .../zabbix/files/zabbix-proxy.conf | 8 +- .../zabbix/files/zabbix-proxy.service | 5 +- .../zabbix/files/zabbix-server-init.service | 21 +++ .../zabbix/files/zabbix-server-init.sh | 139 ++++++++++++++++++ ...-morello.service => zabbix-server.service} | 7 +- .../zabbix/zabbix-agentd-morello_5.0.38.bb | 26 ++-- .../zabbix/zabbix-morello.inc | 7 +- .../zabbix/zabbix-proxy-morello_5.0.38.bb | 42 +++--- .../zabbix/zabbix-server-morello_5.0.38.bb | 69 ++++++--- .../cyrus-sasl/cyrus-sasl_%.bbappend | 2 + .../postgresql/postgresql-morello_9.6.bb | 16 +- ...sql-morello.service => postgresql.service} | 0 15 files changed, 271 insertions(+), 77 deletions(-) rename recipes-connectivity/zabbix/files/{zabbix-agentd-morello.service => zabbix-agentd.service} (100%) create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-init.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-init.sh rename recipes-connectivity/zabbix/files/{zabbix-server-morello.service => zabbix-server.service} (71%) create mode 100644 recipes-daemons/cyrus-sasl/cyrus-sasl_%.bbappend rename recipes-dbs/postgresql/postgresql/{postgresql-morello.service => postgresql.service} (100%)
From: Harrison Marcks hmarcks@thegoodpenguin.co.uk
Signed-off-by: Harrison Carter hcarter@thegoodpenguin.co.uk --- recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb index b7084e2..a0173d8 100644 --- a/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb +++ b/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb @@ -24,6 +24,11 @@ RPROVIDES:${PN} += "zabbix-agentd"
BPN_ZABBIX = "zabbix-agentd"
+SYSTEMD_AUTO_ENABLE:${PN} = "enable" +SYSTEMD_SERVICE:${PN} = "zabbix-agentd.service" + +SERVER_HOSTNAME = "${MACHINE}" + do_install:append() {
install -d ${D}${systemd_system_unitdir} ${D}${sysconfdir}
From: Harrison Marcks hmarcks@thegoodpenguin.co.uk
For debugging
Signed-off-by: Harrison Carter hcarter@thegoodpenguin.co.uk --- kas/morello-linux-debug.yml | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/kas/morello-linux-debug.yml b/kas/morello-linux-debug.yml index bbb535e..ef560e1 100644 --- a/kas/morello-linux-debug.yml +++ b/kas/morello-linux-debug.yml @@ -22,3 +22,5 @@ local_conf_header: image: | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" IMAGE_INSTALL:append = " nano" + IMAGE_FSTYPES:append = " tar.bz2" +
From: Harrison Marcks hmarcks@thegoodpenguin.co.uk
Signed-off-by: Harrison Carter hcarter@thegoodpenguin.co.uk --- recipes-dbs/postgresql/postgresql-morello_9.6.bb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/recipes-dbs/postgresql/postgresql-morello_9.6.bb b/recipes-dbs/postgresql/postgresql-morello_9.6.bb index 6ca7934..20ed21c 100644 --- a/recipes-dbs/postgresql/postgresql-morello_9.6.bb +++ b/recipes-dbs/postgresql/postgresql-morello_9.6.bb @@ -1,6 +1,6 @@ require postgresql-morello.inc
-FILESEXTRAPATHS:prepend := "${THISDIR}/postgresql:${THISDIR}/cheri-patches:" +FILESEXTRAPATHS:prepend := "${THISDIR}/postgresql:${THISDIR}/cheri-patches:${THISDIR}/files:"
PVBASE = "9.6" LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=87da2b84884860b71f5f24ab37e7da78" @@ -59,6 +59,9 @@ PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl-morello,"
export PRINTF_SIZE_T_SUPPORT="yes"
+PG_INIT_SERVICE_FILE = "${D}${systemd_unitdir}/system/postgresql-init.service" +PG_SERVICE_FILE = "${D}${systemd_unitdir}/system/postgresql.service" + do_install:append() {
install_dir="${D}" @@ -71,11 +74,11 @@ do_install:append() { sed -e "s:%DB_DATADIR%:${DB_DATADIR}:g" -i ${D_DEST_DIR}/postgresql-init sed -e "s:%PGINSTALLDIR%:${prefix}:g" -i ${D_DEST_DIR}/postgresql-init sed -e "s:%BINDIR%:${bindir}:g" -i ${D_DEST_DIR}/postgresql-init + sed -e "s:%SYSCONFDIR%:${sysconfdir}:g" -i ${D_DEST_DIR}/postgresql-init
install -d ${D}${systemd_unitdir}/system/
- PG_INIT_SERVICE_FILE=${D}${systemd_unitdir}/system/postgresql-init.service install -m 644 ${WORKDIR}/postgresql-init.service ${PG_INIT_SERVICE_FILE}
sed -e "s:%PGINSTALLDIR%:${prefix}:g" -i ${PG_INIT_SERVICE_FILE} @@ -85,8 +88,8 @@ do_install:append() {
sed -e "s:%DB_USER%:${DB_USER}:g" -i ${PG_INIT_SERVICE_FILE} sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${PG_INIT_SERVICE_FILE} + sed -e "s:%DB_ROOT_PASSWORD%:${DB_ROOT_PASSWORD}:g" -i ${PG_INIT_SERVICE_FILE}
- PG_SERVICE_FILE=${D}${systemd_unitdir}/system/postgresql.service install -m 644 ${WORKDIR}/postgresql-morello.service ${PG_SERVICE_FILE}
sed -e 's,%BINDIR%,${bindir},g' -i ${PG_SERVICE_FILE} @@ -152,4 +155,5 @@ FILES:${PN}-dbg += " \ ${libdir}/${BPN_POSTGRESQL}/pgxs/src/test/regress/test-schedule \ "
-FILES:${PN}-gdb-debug += "/gdb_debug" \ No newline at end of file +FILES:${PN}-gdb-debug += "/gdb_debug" +RPROVIDES:${PN} += "postgresql-setup"
From: Harrison Marcks hmarcks@thegoodpenguin.co.uk
This is required for zabbix to build correctly. OTherwise cyrus sasl complains that the "mail" group is missing.
Signed-off-by: Harrison Carter hcarter@thegoodpenguin.co.uk --- recipes-daemons/cyrus-sasl/cyrus-sasl_%.bbappend | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 recipes-daemons/cyrus-sasl/cyrus-sasl_%.bbappend
diff --git a/recipes-daemons/cyrus-sasl/cyrus-sasl_%.bbappend b/recipes-daemons/cyrus-sasl/cyrus-sasl_%.bbappend new file mode 100644 index 0000000..8bb4dfe --- /dev/null +++ b/recipes-daemons/cyrus-sasl/cyrus-sasl_%.bbappend @@ -0,0 +1,2 @@ +# Required to make zabbix build with necassary users in place +GROUPADD_PARAM:${PN}-bin = " -r mail "
From: Harrison Marcks hmarcks@thegoodpenguin.co.uk
Signed-off-by: Harrison Carter hcarter@thegoodpenguin.co.uk --- .../zabbix/files/zabbix-agentd.conf | 4 +- ...-morello.service => zabbix-agentd.service} | 0 .../zabbix/files/zabbix-proxy.conf | 8 +- .../zabbix/files/zabbix-proxy.service | 5 +- .../zabbix/files/zabbix-server-init.service | 21 +++ .../zabbix/files/zabbix-server-init.sh | 139 ++++++++++++++++++ ...-morello.service => zabbix-server.service} | 7 +- .../zabbix/zabbix-agentd-morello_5.0.38.bb | 23 ++- .../zabbix/zabbix-morello.inc | 7 +- .../zabbix/zabbix-proxy-morello_5.0.38.bb | 42 +++--- .../zabbix/zabbix-server-morello_5.0.38.bb | 69 ++++++--- .../postgresql/postgresql-morello_9.6.bb | 4 +- ...sql-morello.service => postgresql.service} | 0 13 files changed, 255 insertions(+), 74 deletions(-) rename recipes-connectivity/zabbix/files/{zabbix-agentd-morello.service => zabbix-agentd.service} (100%) create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-init.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-init.sh rename recipes-connectivity/zabbix/files/{zabbix-server-morello.service => zabbix-server.service} (71%) rename recipes-dbs/postgresql/postgresql/{postgresql-morello.service => postgresql.service} (100%)
diff --git a/recipes-connectivity/zabbix/files/zabbix-agentd.conf b/recipes-connectivity/zabbix/files/zabbix-agentd.conf index 52dc1b3..34ab2c5 100644 --- a/recipes-connectivity/zabbix/files/zabbix-agentd.conf +++ b/recipes-connectivity/zabbix/files/zabbix-agentd.conf @@ -110,7 +110,7 @@ LogFile=/tmp/zabbix_agentd.log # Default: # Server=
-Server=127.0.0.1 +Server=%ZABBIX_IP_ADDR%
### Option: ListenPort # Agent will listen on this port for connections from the server. @@ -304,7 +304,7 @@ Server=127.0.0.1 # # Mandatory: no # Default: -User=%ZABBIX_USER_NAME% +User=zabbix
### Option: Include # You may include individual files or all files in a directory in the configuration file. diff --git a/recipes-connectivity/zabbix/files/zabbix-agentd-morello.service b/recipes-connectivity/zabbix/files/zabbix-agentd.service similarity index 100% rename from recipes-connectivity/zabbix/files/zabbix-agentd-morello.service rename to recipes-connectivity/zabbix/files/zabbix-agentd.service diff --git a/recipes-connectivity/zabbix/files/zabbix-proxy.conf b/recipes-connectivity/zabbix/files/zabbix-proxy.conf index b5bc0d5..a4b64fc 100644 --- a/recipes-connectivity/zabbix/files/zabbix-proxy.conf +++ b/recipes-connectivity/zabbix/files/zabbix-proxy.conf @@ -35,7 +35,7 @@ ProxyMode=0 # Default: # Server=
-Server=%ZABBIX_SERVER_IPS% +Server=%ZABBIX_IP_ADDR%
### Option: Hostname # Unique, case sensitive Proxy name. Make sure the Proxy name is known to the server! @@ -181,7 +181,7 @@ DBSchema= # Default: # DBUser=
-DBUser=%DB_ZABBIX_USER_PROXY% +DBUser=zabbix
### Option: DBPassword # Database password. Ignored for SQLite. @@ -190,7 +190,7 @@ DBUser=%DB_ZABBIX_USER_PROXY% # Mandatory: no # Default: # DBPassword= -DBPassword=%DB_ZABBIX_PASSWORD% +DBPassword=zabbix
### Option: DBSocket # Path to MySQL socket. @@ -685,7 +685,7 @@ TmpDir=/tmp # Mandatory: no # Default: # StatsAllowedIP= -StatsAllowedIP=%STATS_ALLOWED_IPS% +StatsAllowedIP=127.0.0.1
####### TLS-RELATED PARAMETERS #######
diff --git a/recipes-connectivity/zabbix/files/zabbix-proxy.service b/recipes-connectivity/zabbix/files/zabbix-proxy.service index 7dd77b6..b135c9c 100644 --- a/recipes-connectivity/zabbix/files/zabbix-proxy.service +++ b/recipes-connectivity/zabbix/files/zabbix-proxy.service @@ -3,11 +3,12 @@ Description=Zabbix Proxy
[Service] Environment="CONFFILE=%ZABBIX_PROXY_CONF%" -EnvironmentFile=-%SYSCONFDIR%/default/zabbix-proxy +Environment="SBINDIR=%SBINDIR%" +EnvironmentFile=-%SYSCONFDIR%/default/zabbix_proxy Type=forking Restart=on-failure KillMode=control-group -ExecStart=%SBINDIR%/zabbix_proxy -c $CONFFILE +ExecStart="${SBINDIR}"/zabbix_proxy -c "${CONFFILE}" -f ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID" RestartSec=10s
diff --git a/recipes-connectivity/zabbix/files/zabbix-server-init.service b/recipes-connectivity/zabbix/files/zabbix-server-init.service new file mode 100644 index 0000000..03f7543 --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-server-init.service @@ -0,0 +1,21 @@ +[Unit] +Description=Zabbix Server Init +Wants=postgresql.service +After=postgresql.service +After=postgresql-init.service +After=php-fpm.service + +[Service] +Environment="SYSCONFDIR=%SYSCONFDIR%" +Environment="CONFFILE=%SYSCONFDIR%/zabbix/zabbix-server.conf" +Environment="DB_ZABBIX_USER_SERVER=%DB_ZABBIX_USER_SERVER%" +Environment="DB_ZABBIX_NAME=%DB_ZABBIX_NAME%" +Environment="DB_ZABBIX_PASSWORD=%DB_ZABBIX_PASSWORD%" +Environment="ZABBIX_SCHEMA_LOCATION=%ZABBIX_SCHEMA_LOCATION%" +EnvironmentFile=-%SYSCONFDIR%/default/zabbix-server +Type=oneshot +KillMode=control-group +ExecStart=/bin/bash -c '%SYSCONFDIR%/zabbix/zabbix-server-init.sh' + +[Install] +WantedBy=multi-user.target diff --git a/recipes-connectivity/zabbix/files/zabbix-server-init.sh b/recipes-connectivity/zabbix/files/zabbix-server-init.sh new file mode 100644 index 0000000..55dc837 --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-server-init.sh @@ -0,0 +1,139 @@ + +DATA_FILE=%DB_DATADIR% +BIN_DIR=%BINDIR% + +db_zabbix_template="${DB_ZABBIX_NAME}_template" +db_zabbix_proxy_name="${DB_ZABBIX_NAME}_proxy" + +env + +append_to_hba_conf() { + echo "local ${DB_ZABBIX_USER_SERVER} ${DB_ZABBIX_NAME} password" >> "${DATA_FILE}" + echo "local ${DB_ZABBIX_USER_SERVER} ${db_zabbix_proxy_name} password" >> "${DATA_FILE}" +} + +set_reader_writer() +{ + user="${1}" + sudo -u postgres ${BIN_DIR}/psql -c "GRANT writer TO ${user}" 2> /dev/null + sudo -u postgres ${BIN_DIR}/psql -c "GRANT reader TO ${user}" 2> /dev/null +} + +create_roles() { + sudo -u postgres ${BIN_DIR}/psql -c "CREATE ROLE writer" 2> /dev/null + sudo -u postgres ${BIN_DIR}/psql -c "CREATE ROLE reader" 2> /dev/null + sudo -u postgres ${BIN_DIR}/psql -c "CREATE USER ${DB_ZABBIX_USER_SERVER} WITH PASSWORD '${DB_ZABBIX_PASSWORD}'" 2> /dev/null + + if [ $? -ne 0 ]; then + echo "[INFO] postgres: failed to add users" + exit 1 + fi + + set_reader_writer "${DB_ZABBIX_USER_SERVER}" + set_reader_writer "${DB_ZABBIX_USER_SERVER}" +} + +create_db_from_template() +{ + user="${1}" + db="${2}" + template="${3}" + template_owner="${4}" + sudo -u postgres ${BIN_DIR}/psql -c "CREATE DATABASE ${db} WITH TEMPLATE ${template} OWNER ${user};" 2> /dev/null + sudo -u postgres ${BIN_DIR}/psql -c "REASSIGN OWNED BY ${template_owner} TO ${user}" ${db} 2> /dev/null + sudo -u postgres ${BIN_DIR}/psql -c "GRANT ALL ON DATABASE ${db} TO ${user};" 2> /dev/null + if [ $? -ne 0 ]; then + echo "[INFO] postgres: failed to create db ${db}" + exit 1 + fi +} + +zabbix_schema_setup() +{ + zabbix_user="${1}" + zabbix_db="${2}" + + cat ${ZABBIX_SCHEMA_LOCATION}schema.sql | sudo -u postgres ${BIN_DIR}/psql -d ${zabbix_db} ${zabbix_user} 2> /dev/null + if [ $? -ne 0 ]; then + echo "[INFO] postgres: failed to add schema to ${zabbix_db}" + exit 1 + fi +} + +zabbix_db_setup() +{ + zabbix_user="${1}" + zabbix_db="${2}" + + tot=0 + cat ${ZABBIX_SCHEMA_LOCATION}images.sql | sudo -u postgres ${BIN_DIR}/psql -d ${zabbix_db} ${zabbix_user} 2>&1 > /dev/null + tot=$(($tot+$?)) + cat ${ZABBIX_SCHEMA_LOCATION}data.sql | sudo -u postgres ${BIN_DIR}/psql -d ${zabbix_db} ${zabbix_user} 2>&1 > /dev/null + tot=$(($tot+$?)) + echo $tot +} + +enforce_security_revoke() +{ + db="${1}" + sudo -u postgres ${BIN_DIR}/psql -c "REVOKE ALL ON DATABASE ${db} FROM public" 2> /dev/null +} + +zabbix_create_proxy_db() +{ + zabbix_create_db_from_template "${DB_ZABBIX_USER_SERVER}" "${db_zabbix_proxy_name}" "${db_zabbix_template}" +} + +zabbix_create_db_from_template() +{ + user="${1}" + db="${2}" + template="${3}" + create_db_from_template "${user}" "${db}" "${template}" "${DB_ZABBIX_USER_SERVER}" +} + +zabbix_revoke_from_proxy() +{ + sudo -u postgres ${BIN_DIR}/psql -c "REVOKE ALL ON DATABASE ${db_zabbix_proxy_name} FROM public" 2> /dev/null +} + +set_zabbix_proxy(){ + set_zabbix_role_perms "${db_zabbix_proxy_name}" "${DB_ZABBIX_USER_SERVER}" +} + +set_dbs() { +# Create zabbix db + sudo -u postgres ${BIN_DIR}/psql -c "CREATE DATABASE ${db_zabbix_template} WITH ENCODING 'Unicode' TEMPLATE template0" 2> /dev/null + if [ $? -ne 0 ]; then + echo "[INFO] postgres: failed to create db ${db_zabbix_template}" + exit 1 + fi + # Apply scehma + zabbix_schema_setup "${DB_ZABBIX_USER_SERVER}" "${db_zabbix_template}" + + # Make it a template to save some time + sudo -u postgres ${BIN_DIR}/psql -c "ALTER DATABASE ${db_zabbix_template} WITH IS_TEMPLATE true;" 2> /dev/null + if [ $? -ne 0 ]; then + echo "[INFO] postgres: failed to set template on db ${db_zabbix_template}" + exit 1 + fi + # Create a db from that template + zabbix_create_db_from_template "${DB_ZABBIX_USER_SERVER}" "${DB_ZABBIX_NAME}" "${db_zabbix_template}" + + zabbix_db_setup "${DB_ZABBIX_USER_SERVER}" "${DB_ZABBIX_NAME}" + + zabbix_create_proxy_db "${db_zabbix_proxy_name}" + + enforce_security_revoke "${DB_ZABBIX_NAME}" +} + +create_roles +set_dbs + +sudo -u postgres ${BIN_DIR}/psql -c "GRANT USAGE ON SCHEMA public TO ${DB_ZABBIX_USER_SERVER}" 2> /dev/null +sudo -u postgres ${BIN_DIR}/psql -d "${DB_ZABBIX_NAME}" -c "GRANT ALL ON DATABASE ${DB_ZABBIX_NAME} TO ${DB_ZABBIX_USER_SERVER}" 2> /dev/null +sudo -u postgres ${BIN_DIR}/psql -d "${DB_ZABBIX_NAME}" -c "GRANT CONNECT ON DATABASE ${DB_ZABBIX_NAME} TO ${DB_ZABBIX_USER_SERVER}" 2> /dev/null +sudo -u postgres ${BIN_DIR}/psql -d "${DB_ZABBIX_NAME}" -c "GRANT ALL ON DATABASE ${DB_ZABBIX_NAME} TO ${DB_ZABBIX_USER_SERVER}" 2> /dev/null +sudo -u postgres ${BIN_DIR}/psql -c "GRANT USAGE ON SCHEMA public TO ${DB_ZABBIX_USER_SERVER}" 2> /dev/null + +append_to_hba_conf diff --git a/recipes-connectivity/zabbix/files/zabbix-server-morello.service b/recipes-connectivity/zabbix/files/zabbix-server.service similarity index 71% rename from recipes-connectivity/zabbix/files/zabbix-server-morello.service rename to recipes-connectivity/zabbix/files/zabbix-server.service index 3327b4b..36fb0a3 100644 --- a/recipes-connectivity/zabbix/files/zabbix-server-morello.service +++ b/recipes-connectivity/zabbix/files/zabbix-server.service @@ -1,18 +1,17 @@ [Unit] Description=Zabbix Server Wants=postgresql.service -After=postgresql.service -After=postgresql-init.service -After=php-fpm.service +After=zabbix-server-init.service
[Service] Environment="CONFFILE=%SYSCONFDIR%/zabbix/zabbix-server.conf" Environment="DB_ZABBIX_USER_SERVER=%DB_ZABBIX_USER_SERVER%" Environment="DB_ZABBIX_PASSWORD=%DB_ZABBIX_PASSWORD%" +Environment="SBINDIR=%SBINDIR%" EnvironmentFile=-%SYSCONFDIR%/default/zabbix-server Type=forking KillMode=control-group -ExecStart=/bin/bash -c '%SBINDIR%/zabbix_server -c ${CONFFILE}' +ExecStart=/bin/bash -c '${SBINDIR}/zabbix_server -c ${CONFFILE}' ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID" RestartSec=10s
diff --git a/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb index a0173d8..1d8cd53 100644 --- a/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb +++ b/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb @@ -1,13 +1,15 @@ -inherit perlnative autotools-brokensep pure-cap-kheaders pkgconfig systemd useradd -inherit purecap-sysroot purecap-useradd +inherit purecap-useradd purecap-sysroot
require zabbix-morello.inc
SRC_URI += " \ - file://zabbix-agentd-morello.service \ + file://zabbix-agentd.service \ file://zabbix-agentd.conf \ "
+DEPENDS = " curl-morello " +RDEPENDS:${PN} = " curl-morello " + # Seperate user for agent for security reasons. If the user is shared the agent # will have full access to the server's DB. USERADD_PACKAGES += " \ @@ -25,25 +27,21 @@ RPROVIDES:${PN} += "zabbix-agentd" BPN_ZABBIX = "zabbix-agentd"
SYSTEMD_AUTO_ENABLE:${PN} = "enable" -SYSTEMD_SERVICE:${PN} = "zabbix-agentd.service" +SYSTEMD_SERVICE:${PN} = "${BPN_ZABBIX}.service"
SERVER_HOSTNAME = "${MACHINE}"
do_install:append() {
- install -d ${D}${systemd_system_unitdir} ${D}${sysconfdir} - install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.service ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service
sed -i -e 's#%SBINDIR%#${sbindir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service sed -i -e 's#%SYSCONFDIR%#${sysconfdir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service
- install -d ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf.d/ + install -d ${D}${sysconfdir}/zabbix/ install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.conf ${D}${sysconfdir}/zabbix/ - - sed -i -e 's#%DB_ZABBIX_USER_AGENT%#${DB_ZABBIX_USER_AGENT}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service - sed -i -e 's#%DB_ZABBIX_USER_AGENT%#${DB_ZABBIX_USER_AGENT}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf - sed -i -e 's#%ZABBIX_USER_NAME%#${DB_ZABBIX_USER_AGENT}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf - + sed -i -e 's#%ZABBIX_IP_ADDR%#${ZABBIX_IP_ADDR}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf }
do_install:append() { @@ -53,5 +51,6 @@ do_install:append() {
FILES:${PN} += " ${libdir} \ ${systemd_system_unitdir}/${BPN_ZABBIX}.service \ + ${sysconfdir} \ " FILES:${PN}-dbg += "${datadir}" \ No newline at end of file diff --git a/recipes-connectivity/zabbix/zabbix-morello.inc b/recipes-connectivity/zabbix/zabbix-morello.inc index 71fa5e3..8c25de8 100644 --- a/recipes-connectivity/zabbix/zabbix-morello.inc +++ b/recipes-connectivity/zabbix/zabbix-morello.inc @@ -1,3 +1,5 @@ +inherit perlnative autotools-brokensep pure-cap-kheaders pkgconfig systemd + SUMMARY = "Open-source monitoring solution for your IT infrastructure"
MORELLO_SRC = "meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_5.4.12.bb" @@ -24,6 +26,7 @@ LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=300e938ad303147fede2294ed78fe02e"
FILESEXTRAPATHS:prepend := "${THISDIR}/cheri-patches:" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" TOOLCHAIN = "${MORELLO_TOOLCHAIN}"
PV = "5.0.38" @@ -65,7 +68,7 @@ PACKAGECONFIG[ldap] = "--with-ldap=${STAGING_EXECPREFIXDIR},--without-ldap PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_EXECPREFIXDIR},--without-zlib,zlib-morello" PACKAGECONFIG[libpthread] = "--with-libpthread=${STAGING_EXECPREFIXDIR},--without-libpthread," PACKAGECONFIG[libpcre] = "--with-libpcre=${STAGING_EXECPREFIXDIR},--without-libpcre,libpcre-morello" -PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_BINDIR}/curl-config, --without-libcurl, curl-morello" +PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_BINDIR}/crossscripts/curl-config, --without-libcurl, curl-morello" PACKAGECONFIG[iconv] = "--with-iconv=${STAGING_EXECPREFIXDIR},--without-iconv,virtual/libiconv"
EXTRA_OECONF = " \ @@ -100,4 +103,4 @@ do_install:append() { rm -f ${D}${sbindir}/.debug/zabbix_agentd }
-SYSROOT_DIRS:remove = "${datadir}" \ No newline at end of file +SYSROOT_DIRS:remove = "${datadir}" diff --git a/recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb index a5867e0..860bbff 100644 --- a/recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb +++ b/recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb @@ -1,5 +1,4 @@ -inherit perlnative autotools-brokensep pure-cap-kheaders pkgconfig systemd useradd -inherit purecap-sysroot purecap-useradd +inherit purecap-sysroot
require zabbix-morello.inc
@@ -16,17 +15,19 @@ USERADD_PACKAGES += " \
EXTRA_OECONF += "--enable-proxy"
-USERADD_PARAM:${PN} = "-r -g ${DB_ZABBIX_USER_SERVER} -d ${localstatedir}/lib/${DB_ZABBIX_USER_SERVER} \ - -s /sbin/nologin -c 'Zabbix Monitoring System' ${DB_ZABBIX_USER_SERVER} \ +GROUPADD_PARAM:${PN} = " ${DB_ZABBIX_USER_PROXY}" +USERADD_PARAM:${PN} = "-r -g ${DB_ZABBIX_USER_PROXY} -d ${localstatedir}/lib/${DB_ZABBIX_USER_PROXY} \ + -s /sbin/nologin -c 'Zabbix Monitoring System' ${DB_ZABBIX_USER_PROXY} \ " -GROUPADD_PARAM:${PN} = "-r ${DB_ZABBIX_USER_SERVER}"
RPROVIDES:${PN} += "zabbix-proxy"
BPN_ZABBIX = "zabbix-proxy"
SYSTEMD_AUTO_ENABLE:${PN} = "enable" -SYSTEMD_SERVICE:${PN} = "zabbix-proxy.service" +SYSTEMD_SERVICE:${PN} = "${BPN_ZABBIX}.service" + +SERVICE_FILE = "${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service"
do_install:append() {
@@ -34,32 +35,23 @@ do_install:append() { install -d ${D}${sbindir} install -d ${D}${sysconfdir}
- SERVICE_FILE="${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service" install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.service ${SERVICE_FILE} sed -i -e 's#%SBINDIR%#${sbindir}#g' ${SERVICE_FILE} sed -i -e 's#%SYSCONFDIR%#${sbindir}#g' ${SERVICE_FILE} - sed -i -e 's#%ZABBIX_PROXY_CONF%#${sysconfdir}/zabbix-proxy.conf#g' ${SERVICE_FILE} - - # N.B. For release use Access Tokens or similiar - sed -i -e 's#%DB_ZABBIX_USER_SERVER%#Admin#g' ${SERVICE_FILE} - sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${SERVICE_FILE} - - ZABBIX_CONF_DIR="${D}${sysconfdir}/zabbix/" - install -d ${ZABBIX_CONF_DIR} - install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.conf ${ZABBIX_CONF_DIR} - - sed -i -e 's#%DB_ZABBIX_NAME%#${DB_ZABBIX_NAME}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf - sed -i -e 's#%DB_ZABBIX_USER_PROXY%#${DB_ZABBIX_USER_PROXY}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf - sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf - sed -i -e 's#%ZABBIX_SERVER_IPS%#${ZABBIX_IP_ADDR}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf - sed -i -e 's#%STATS_ALLOWED_IPS%#${ZABBIX_IP_ADDR}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf - - sed -i -e 's#%ZABBIX_SOCKET_DIR%#/tmp/#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf + sed -i -e 's#%ZABBIX_PROXY_CONF%#${sysconfdir}/${BPN_ZABBIX}.conf#g' ${SERVICE_FILE}
+ install -d ${D}${sysconfdir}/zabbix/ + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.conf ${D}${sysconfdir}/zabbix/ + sed -i -e 's#%ZABBIX_IP_ADDR%#${ZABBIX_IP_ADDR}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + sed -i -e 's#%DB_ZABBIX_NAME%#zabbix#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf }
+do_install:append() { + ${OBJDUMP} -D ${D}${sbindir}/zabbix_proxy > ${D}${sbindir}/zabbix_proxy.dump + ${READELF} -a ${D}${sbindir}/zabbix_proxy > ${D}${sbindir}/zabbix_proxy.readelf +}
FILES:${PN} += "${libdir} \ ${systemd_system_unitdir}/${BPN_ZABBIX}.service \ " -FILES:${PN}-dbg += "${datadir}" \ No newline at end of file +FILES:${PN}-dbg += "${datadir}" diff --git a/recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb index 941fad6..230db8d 100644 --- a/recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb +++ b/recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb @@ -1,11 +1,12 @@ -inherit perlnative autotools-brokensep pure-cap-kheaders pkgconfig systemd useradd -inherit purecap-sysroot purecap-useradd +inherit purecap-useradd purecap-sysroot
require zabbix-morello.inc
SRC_URI:append = " \ file://zabbix-server.conf \ - file://zabbix-server-morello.service \ + file://zabbix-server.service \ + file://zabbix-server-init.service \ + file://zabbix-server-init.sh \ "
# Seperate user for agent for security reasons. If the user is shared the agent @@ -16,10 +17,10 @@ USERADD_PACKAGES += " \
EXTRA_OECONF += "--enable-server"
-USERADD_PARAM:${PN} = "-r -g ${DB_ZABBIX_USER_SERVER} -d ${localstatedir}/lib/${DB_ZABBIX_USER_SERVER} \ +GROUPADD_PARAM:${PN} = " ${DB_ZABBIX_USER_SERVER}" +USERADD_PARAM:${PN} = "-r -g ${DB_ZABBIX_USER_SERVER} -d ${localstatedir}/lib/${DB_ZABBIX_USER_SERVER} \ -s /sbin/nologin -c 'Zabbix Monitoring System' ${DB_ZABBIX_USER_SERVER} \ " -GROUPADD_PARAM:${PN} = "-r ${DB_ZABBIX_USER_SERVER}"
RPROVIDES:${PN} += "zabbix-server" RDEPENDS:${PN} += " busybox bash " @@ -27,37 +28,57 @@ RDEPENDS:${PN} += " busybox bash " BPN_ZABBIX = "zabbix-server"
SYSTEMD_AUTO_ENABLE:${PN} = "enable" -SYSTEMD_SERVICE:${PN} = "zabbix-server.service" +SYSTEMD_SERVICE:${PN} = "zabbix-server.service zabbix-server-init.service"
+ZBX_SCHEMA_DIR = "${sysconfdir}/zabbix/schema/"
do_install:append() {
+ PSQL_HBA_CONF="/var/lib/postgresql/data/pg_hba.conf" + install -d ${D}${sysconfdir}/zabbix install -d ${D}${systemd_system_unitdir} ${D}${sysconfdir} - install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + install -m 0755 ${WORKDIR}/zabbix-server-init.sh ${D}${sysconfdir}/zabbix + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}-init.service ${D}${systemd_system_unitdir}/${BPN_ZABBIX}-init.service + sed -i -e "s|%ZABBIX_SCHEMA_LOCATION%|${ZBX_SCHEMA_DIR}|g" ${D}${systemd_system_unitdir}/${BPN_ZABBIX}-init.service + + sed -i -e "s|%DB_DATADIR%|${PSQL_HBA_CONF}|g" ${D}${sysconfdir}/zabbix/zabbix-server-init.sh + sed -i -e "s|%BINDIR%|${bindir}|g" ${D}${sysconfdir}/zabbix/zabbix-server-init.sh + sed -i -e 's#%SBINDIR%#${sbindir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}-init.service + sed -i -e 's#%SYSCONFDIR%#${sysconfdir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}-init.service + sed -i -e 's#%DB_ZABBIX_USER_SERVER%#${DB_ZABBIX_USER_SERVER}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}-init.service + sed -i -e 's#%DB_ZABBIX_NAME%#zabbix#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}-init.service + sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}-init.service +} + +do_install:append() { + + install -d ${D}${systemd_system_unitdir} ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.service ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service
sed -i -e 's#%SBINDIR%#${sbindir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service sed -i -e 's#%SYSCONFDIR%#${sysconfdir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service
- sed -i -e 's#%DB_ZABBIX_USER_SERVER%#Admin#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + sed -i -e 's#%DB_ZABBIX_USER_SERVER%#${DB_ZABBIX_USER_SERVER}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service +}
- install -d ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf.d/ +do_install:append() { install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.conf ${D}${sysconfdir}/zabbix/ - - install -d ${D}${sysconfdir}/zabbix/schema - - sed -i -e 's#%DB_ZABBIX_NAME%#${DB_ZABBIX_NAME}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + sed -i -e 's#%ZABBIX_SOCKET_DIR%#/tmp/#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + sed -i -e 's#%ZABBIX_IP_ADDR%#${ZABBIX_IP_ADDR}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf sed -i -e 's#%DB_ZABBIX_USER_SERVER%#${DB_ZABBIX_USER_SERVER}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + sed -i -e 's#%DB_ZABBIX_NAME%#zabbix#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf
- sed -i -e 's#%ZABBIX_SOCKET_DIR%#/tmp/#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf +}
- ZABBIX_SCHEMA_LOC=${D}${sysconfdir}/zabbix/schema +do_install:append() {
- install -d ${ZABBIX_SCHEMA_LOC} - install -m 0644 ${S}/database/postgresql/schema.sql ${ZABBIX_SCHEMA_LOC} - install -m 0644 ${S}/database/postgresql/images.sql ${ZABBIX_SCHEMA_LOC} - install -m 0644 ${S}/database/postgresql/data.sql ${ZABBIX_SCHEMA_LOC} + install -d ${D}${sysconfdir}/zabbix/schema + install -d ${D}${ZBX_SCHEMA_DIR} + install -m 0644 ${S}/database/postgresql/schema.sql ${D}${ZBX_SCHEMA_DIR} + install -m 0644 ${S}/database/postgresql/images.sql ${D}${ZBX_SCHEMA_DIR} + install -m 0644 ${S}/database/postgresql/data.sql ${D}${ZBX_SCHEMA_DIR} }
do_install:append() { @@ -65,7 +86,13 @@ do_install:append() { ${READELF} -a ${D}${sbindir}/zabbix_server > ${D}${PURECAP_DEBUGDIR}/zabbix_server.readelf }
-FILES:${PN} += " ${libdir} \ +FILES:${PN} = " ${libdir} \ + ${sysconfdir} \ + ${bindir} \ + ${sbindir} \ + ${datadir} \ ${systemd_system_unitdir}/${BPN_ZABBIX}.service \ + ${systemd_system_unitdir}/${BPN_ZABBIX}-init.service \ + /morello-debug/ \ " -FILES:${PN}-dbg += "${datadir}" \ No newline at end of file +FILES:${PN}-dbg = "${datadir}" \ No newline at end of file diff --git a/recipes-dbs/postgresql/postgresql-morello_9.6.bb b/recipes-dbs/postgresql/postgresql-morello_9.6.bb index 20ed21c..f72c246 100644 --- a/recipes-dbs/postgresql/postgresql-morello_9.6.bb +++ b/recipes-dbs/postgresql/postgresql-morello_9.6.bb @@ -22,7 +22,7 @@ SRC_URI += "\ SRC_URI += " \ file://postgresql-init \ file://postgresql-init.service \ - file://postgresql-morello.service \ + file://postgresql.service \ "
SRC_URI += "\ @@ -90,7 +90,7 @@ do_install:append() { sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${PG_INIT_SERVICE_FILE} sed -e "s:%DB_ROOT_PASSWORD%:${DB_ROOT_PASSWORD}:g" -i ${PG_INIT_SERVICE_FILE}
- install -m 644 ${WORKDIR}/postgresql-morello.service ${PG_SERVICE_FILE} + install -m 644 ${WORKDIR}/postgresql.service ${PG_SERVICE_FILE}
sed -e 's,%BINDIR%,${bindir},g' -i ${PG_SERVICE_FILE} sed -e "s:%PGINSTALLDIR%:${prefix}:g" -i ${PG_SERVICE_FILE} diff --git a/recipes-dbs/postgresql/postgresql/postgresql-morello.service b/recipes-dbs/postgresql/postgresql/postgresql.service similarity index 100% rename from recipes-dbs/postgresql/postgresql/postgresql-morello.service rename to recipes-dbs/postgresql/postgresql/postgresql.service
Hi Harry,
It looks good to me.
Kind regards, Pawel
On Tue, 25 Jun 2024 at 09:36, Harrison Carter hcarter@thegoodpenguin.co.uk wrote:
From: Harrison Carter hcarter@thegoodpenguin.co.uk
This patch series adds a basic zabbix server, frontend, and agent for a morello distro
Harrison Marcks (5): zabbix-agentd: re-add systemd config kas: add fstype tar.bz2 postgresql: fix file dominion cyrus-sasl: add missing group for zabbix-server zabbix-server: add init script for zabbix DB
kas/morello-linux-debug.yml | 2 + .../zabbix/files/zabbix-agentd.conf | 4 +- ...-morello.service => zabbix-agentd.service} | 0 .../zabbix/files/zabbix-proxy.conf | 8 +- .../zabbix/files/zabbix-proxy.service | 5 +- .../zabbix/files/zabbix-server-init.service | 21 +++ .../zabbix/files/zabbix-server-init.sh | 139 ++++++++++++++++++ ...-morello.service => zabbix-server.service} | 7 +- .../zabbix/zabbix-agentd-morello_5.0.38.bb | 26 ++-- .../zabbix/zabbix-morello.inc | 7 +- .../zabbix/zabbix-proxy-morello_5.0.38.bb | 42 +++--- .../zabbix/zabbix-server-morello_5.0.38.bb | 69 ++++++--- .../cyrus-sasl/cyrus-sasl_%.bbappend | 2 + .../postgresql/postgresql-morello_9.6.bb | 16 +- ...sql-morello.service => postgresql.service} | 0 15 files changed, 271 insertions(+), 77 deletions(-) rename recipes-connectivity/zabbix/files/{zabbix-agentd-morello.service => zabbix-agentd.service} (100%) create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-init.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-init.sh rename recipes-connectivity/zabbix/files/{zabbix-server-morello.service => zabbix-server.service} (71%) create mode 100644 recipes-daemons/cyrus-sasl/cyrus-sasl_%.bbappend rename recipes-dbs/postgresql/postgresql/{postgresql-morello.service => postgresql.service} (100%)
-- 2.34.1
linux-morello-distros mailing list -- linux-morello-distros@op-lists.linaro.org To unsubscribe send an email to linux-morello-distros-leave@op-lists.linaro.org
linux-morello-distros@op-lists.linaro.org