public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Robin Roevens <robin.roevens@disroot.org>
To: development@lists.ipfire.org
Cc: Robin Roevens <robin.roevens@disroot.org>
Subject: [PATCH 4/6] zabbix_agentd: Add LocationDB functionality
Date: Thu, 17 Jul 2025 19:52:03 +0200	[thread overview]
Message-ID: <20250717180805.5754-5-robin.roevens@disroot.org> (raw)
In-Reply-To: <20250717180805.5754-1-robin.roevens@disroot.org>

Adds new IPFire specific monitoring capabilities to Zabbix Agent:
- ipfire.locationdb.lookup[<ip>,<ip>,...]: Perform IPFire LocationDB lookups
  from within Zabbix. Returns a JSON dict.
- ipfire.locationdb.version: Get LocationDB version timestamp in unixtime.

Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
---
 config/rootfiles/packages/zabbix_agentd            | 1 +
 config/zabbix_agentd/userparameter_locationdb.conf | 6 ++++++
 lfs/zabbix_agentd                                  | 2 ++
 3 files changed, 9 insertions(+)
 create mode 100644 config/zabbix_agentd/userparameter_locationdb.conf

diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd
index 52cb37e93..7f1f39b64 100644
--- a/config/rootfiles/packages/zabbix_agentd
+++ b/config/rootfiles/packages/zabbix_agentd
@@ -23,6 +23,7 @@ var/ipfire/zabbix_agentd/userparameters/userparameter_ipfire.conf
 var/ipfire/zabbix_agentd/userparameters/userparameter_ovpn.conf
 var/ipfire/zabbix_agentd/userparameters/userparameter_gateway.conf
 var/ipfire/zabbix_agentd/userparameters/userparameter_wireguard.conf
+var/ipfire/zabbix_agentd/userparameters/userparameter_locationdb.conf
 var/ipfire/zabbix_agentd/scripts
 var/ipfire/zabbix_agentd/scripts/ipfire_certificate_detail.sh
 var/ipfire/zabbix_agentd/scripts/ipfire_services.pl
diff --git a/config/zabbix_agentd/userparameter_locationdb.conf b/config/zabbix_agentd/userparameter_locationdb.conf
new file mode 100644
index 000000000..4aa540762
--- /dev/null
+++ b/config/zabbix_agentd/userparameter_locationdb.conf
@@ -0,0 +1,6 @@
+# Parameters for querying IPFire Location DB
+#
+# Returns Location DB lookup for one or more IP addresses
+UserParameter=ipfire.locationdb.lookup[*],/usr/bin/location lookup $1 $2 $3 $4 $5 $6 $7 $8 $9 2>&1 | awk -F"[[:space:]]*:[[:space:]]*" 'BEGIN { printf "{" } /[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+:/ { printf "%s\"%s\":{",separator,$$1; separator = "," } /^[[:space:]]*Network/ { printf "\"network\":\"" $$2 "\"" } /^[[:space:]]*Country/ { printf ",\"country\":\"" $$2 "\"" } /^[[:space:]]*Autonomous System/ { printf ",\"as\":\"" $$2 "\"}" } /Errno [[:digit:]]+/ { printf "\"error\":\"%s\"",$$0 } END { printf "}" }'
+# Returns the Unix timestamp of the IPFire Location DB version
+UserParameter=ipfire.locationdb.version,date -d"$(/usr/bin/location version)" +%s
diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd
index 6d0a6b4ea..db43bd611 100644
--- a/lfs/zabbix_agentd
+++ b/lfs/zabbix_agentd
@@ -116,6 +116,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 		/var/ipfire/zabbix_agentd/userparameters/userparameter_gateway.conf
 	install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/userparameter_wireguard.conf \
 		/var/ipfire/zabbix_agentd/userparameters/userparameter_wireguard.conf
+	install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/userparameter_locationdb.conf \
+		/var/ipfire/zabbix_agentd/userparameters/userparameter_locationdb.conf
 
 	# Install IPFire-specific Zabbix Agent scripts
 	-mkdir -pv /var/ipfire/zabbix_agentd/scripts
-- 
2.50.1


-- 
Dit bericht is gescanned op virussen en andere gevaarlijke
inhoud door MailScanner en lijkt schoon te zijn.



  parent reply	other threads:[~2025-07-17 18:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 17:51 [PATCH 0/6] zabbix_agentd: More functionality + CRITICAL OpenVPN fixes Robin Roevens
2025-07-17 17:52 ` [PATCH 1/6] zabbix_agentd: Update to 7.0.16 (LTS) Robin Roevens
2025-07-17 17:52 ` [PATCH 2/6] zabbix_agentd: Add ARPing method for checking Internet Gateway Robin Roevens
2025-07-17 17:52 ` [PATCH 3/6] zabbix_agentd: Add WireGuard specific monitoring items Robin Roevens
2025-07-17 17:52 ` Robin Roevens [this message]
2025-07-17 17:52 ` [PATCH 5/6] zabbix_agentd: Openvpn-2.6: fix pid name for services stats Robin Roevens
2025-07-17 17:52 ` [PATCH 6/6] zabbix_agentd: Openvpn-2.6: use the helper binary to read the status log Robin Roevens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250717180805.5754-5-robin.roevens@disroot.org \
    --to=robin.roevens@disroot.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox