summaryrefslogtreecommitdiff
path: root/net-mgmt/simplomon
diff options
context:
space:
mode:
Diffstat (limited to 'net-mgmt/simplomon')
-rw-r--r--net-mgmt/simplomon/Makefile60
-rw-r--r--net-mgmt/simplomon/distinfo9
-rw-r--r--net-mgmt/simplomon/files/patch-mailmon.cc12
-rw-r--r--net-mgmt/simplomon/files/patch-meson.build22
-rw-r--r--net-mgmt/simplomon/files/patch-notifiers.cc17
-rw-r--r--net-mgmt/simplomon/files/pkg-message.in16
-rw-r--r--net-mgmt/simplomon/files/simplomon.in54
-rw-r--r--net-mgmt/simplomon/pkg-descr6
8 files changed, 196 insertions, 0 deletions
diff --git a/net-mgmt/simplomon/Makefile b/net-mgmt/simplomon/Makefile
new file mode 100644
index 000000000000..63c670ac3c1a
--- /dev/null
+++ b/net-mgmt/simplomon/Makefile
@@ -0,0 +1,60 @@
+PORTNAME= simplomon
+DISTVERSION= g20250224
+CATEGORIES= net-mgmt dns net
+MAINTAINER= dch@FreeBSD.org
+COMMENT= Simple network status and uptime monitoring tool
+WWW= https://github.com/berthubert/simplomon
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pip>0:devel/py-pip@${PY_FLAVOR} \
+ nlohmann-json>0:devel/nlohmann-json \
+ xxd>0:sysutils/xxd
+
+LIB_DEPENDS= libcurl.so:ftp/curl \
+ libfmt.so:devel/libfmt \
+ libnghttp2.so:www/libnghttp2
+USES= cmake:indirect compiler:c++17-lang llvm:18,build lua:53,build \
+ meson ninja pkgconfig python:build sqlite ssl
+
+USE_GITHUB= yes
+GH_ACCOUNT= berthubert
+GH_TAGNAME= b4fea5b # https://github.com/berthubert/simplomon/pull/58
+GH_TUPLE= berthubert:sqlitewrite:a2c2ee:sqlitewrite \
+ ahuPowerDNS:simplesocket:3af5e1d:simplesocket \
+ yhirose:cpp-httplib:v0.13.1:httplib
+
+USE_RC_SUBR= simplomon
+
+MESON_ARGS+= --default-library=static \
+ --prefer-static \
+ --strip \
+ --wrap-mode=nodownload
+
+SUB_FILES= pkg-message simplomon
+SUB_LIST= ETCDIR=${ETCDIR}
+
+PLIST_FILES= bin/simplomon
+PORTDOCS= README.md
+
+OPTIONS_DEFINE= DOCS
+
+post-extract:
+ ${RLN} ${WRKDIR}/sqlitewrite-* ${WRKSRC}/subprojects/sqlitewriter
+ ${RLN} ${WRKDIR}/simplesocket-* ${WRKSRC}/subprojects/simplesockets
+ ${RLN} ${WRKDIR}/cpp-httplib-* ${WRKSRC}/subprojects/
+
+post-build:
+ ${RM} -rf ${WRKDIR}/_build/meson-private ${WRKSRC}/subprojects
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/_build/simplomon \
+ ${STAGEDIR}${PREFIX}/bin
+
+post-install-DOCS-on:
+ ${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} \
+ ${STAGEDIR}${DOCSDIR}
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/simplomon/distinfo b/net-mgmt/simplomon/distinfo
new file mode 100644
index 000000000000..f13d8452e4fe
--- /dev/null
+++ b/net-mgmt/simplomon/distinfo
@@ -0,0 +1,9 @@
+TIMESTAMP = 1741342561
+SHA256 (berthubert-simplomon-g20250224-b4fea5b_GH0.tar.gz) = 834aa0f83167feb1b9eeb36602bb933cb71884dcf558fea8e69cce73a2556c4f
+SIZE (berthubert-simplomon-g20250224-b4fea5b_GH0.tar.gz) = 260634
+SHA256 (berthubert-sqlitewrite-a2c2ee_GH0.tar.gz) = 5a0d40c1e1e28a673fbc9b2f311bc97a629470a8388c0aa297720a7a83d4d8d8
+SIZE (berthubert-sqlitewrite-a2c2ee_GH0.tar.gz) = 78179
+SHA256 (ahuPowerDNS-simplesocket-3af5e1d_GH0.tar.gz) = 5a5ee9856f0ec44ddbb956c6f35408f2f90e37c2fc66269603aae7b190051c76
+SIZE (ahuPowerDNS-simplesocket-3af5e1d_GH0.tar.gz) = 84280
+SHA256 (yhirose-cpp-httplib-v0.13.1_GH0.tar.gz) = 9b837d290b61e3f0c4239da0b23bbf14c382922e2bf2a9bac21c1e3feabe1ff9
+SIZE (yhirose-cpp-httplib-v0.13.1_GH0.tar.gz) = 644015
diff --git a/net-mgmt/simplomon/files/patch-mailmon.cc b/net-mgmt/simplomon/files/patch-mailmon.cc
new file mode 100644
index 000000000000..dded82335e7c
--- /dev/null
+++ b/net-mgmt/simplomon/files/patch-mailmon.cc
@@ -0,0 +1,12 @@
+--- mailmon.cc.orig 2025-11-03 17:55:52 UTC
++++ mailmon.cc
+@@ -246,7 +246,8 @@ CheckResult SMTPChecker::perform()
+ msg+=fmt::format("Message-Id: <{}@simplomon.hostname>\r\n", time(nullptr));
+
+ //Date: Thu, 28 Dec 2023 14:31:37 +0100 (CET)
+- msg += fmt::format("Date: {:%a, %d %b %Y %H:%M:%S %z (%Z)}\r\n", fmt::localtime(time(0)));
++ time_t now = time(0);
++ msg += fmt::format("Date: {:%a, %d %b %Y %H:%M:%S %z (%Z)}\r\n", *std::localtime(&now));
+ msg+="\r\n";
+
+ msg+=to_string(time(nullptr))+"\r\n";
diff --git a/net-mgmt/simplomon/files/patch-meson.build b/net-mgmt/simplomon/files/patch-meson.build
new file mode 100644
index 000000000000..7ee99bcf1842
--- /dev/null
+++ b/net-mgmt/simplomon/files/patch-meson.build
@@ -0,0 +1,22 @@
+--- meson.build.orig 2025-02-19 22:01:58 UTC
++++ meson.build
+@@ -66,7 +66,6 @@ sqlitewriter_dep = dependency('sqlitewriter', static:
+
+ cpphttplib = dependency('cpp-httplib')
+ sqlitewriter_dep = dependency('sqlitewriter', static: true)
+-doctest_dep=dependency('doctest')
+ simplesockets_dep = dependency('simplesockets', static: true)
+ # argparse_dep = dependency('argparse', version: '>=3')
+
+@@ -104,11 +103,3 @@ webpages,
+ webpages,
+ dependencies: [json_dep, fmt_dep, cpphttplib,
+ simplesockets_dep, lua_dep, curl_dep, sqlite_dep, sqlitewriter_dep])
+-
+-executable('testrunner', 'testrunner.cc', 'notifiers.cc', 'minicurl.cc', 'dnsmon.cc', 'record-types.cc', 'dnsmessages.cc', 'dns-storage.cc', 'netmon.cc', 'luabridge.cc', 'webservice.cc', 'support.cc', 'promon.cc', 'mailmon.cc', 'nonblocker.cc',
+- dependencies: [doctest_dep, curl_dep, json_dep, fmt_dep, cpphttplib, sqlite_dep,
+- simplesockets_dep, lua_dep, sqlitewriter_dep])
+-
+-
+-
+-
diff --git a/net-mgmt/simplomon/files/patch-notifiers.cc b/net-mgmt/simplomon/files/patch-notifiers.cc
new file mode 100644
index 000000000000..d3d6159fabd7
--- /dev/null
+++ b/net-mgmt/simplomon/files/patch-notifiers.cc
@@ -0,0 +1,17 @@
+--- notifiers.cc.orig 2025-11-01 23:43:58 UTC
++++ notifiers.cc
+@@ -117,7 +117,8 @@ static void sendAsciiEmailAsync(const std::string& ser
+ sc.writen(fmt::format("Message-Id: <{}@simplomon.hostname>\r\n", getRandom64()));
+
+ //Date: Thu, 28 Dec 2023 14:31:37 +0100 (CET)
+- sc.writen(fmt::format("Date: {:%a, %d %b %Y %H:%M:%S %z (%Z)}\r\n", fmt::localtime(time(0))));
++ time_t now = time(0);
++ sc.writen(fmt::format("Date: {:%a, %d %b %Y %H:%M:%S %z (%Z)}\r\n", *std::localtime(&now)));
+ sc.writen("\r\n");
+
+ string withCrlf;
+@@ -267,4 +268,3 @@ void TelegramNotifier::alert(const std::string& messag
+
+ // fmt::print("{}\n", res->body);
+ }
+-
diff --git a/net-mgmt/simplomon/files/pkg-message.in b/net-mgmt/simplomon/files/pkg-message.in
new file mode 100644
index 000000000000..ba32dd61bf5e
--- /dev/null
+++ b/net-mgmt/simplomon/files/pkg-message.in
@@ -0,0 +1,16 @@
+[
+{ type: install
+ message: <<EOM
+Note this is a port of alpha-grade software. In local testing it has shown
+to be solid already, but not all functionality works as expected on
+FreeBSD yet, or may not work correctly at all. The port comes with an rc
+daemon, expecting a config file in %%ETCDIR%%/simplomon.conf .
+See the README.md for detailed configuration and setup.
+
+Please report any issues on the upstream PR:
+
+ https://github.com/berthubert/simplomon/pull/58
+
+EOM
+}
+]
diff --git a/net-mgmt/simplomon/files/simplomon.in b/net-mgmt/simplomon/files/simplomon.in
new file mode 100644
index 000000000000..e216c9f4af54
--- /dev/null
+++ b/net-mgmt/simplomon/files/simplomon.in
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# PROVIDE: simplomon
+# REQUIRE: NETWORKING SERVERS
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# simplomon_enable (bool): Set to NO by default.
+# Set it to YES to enable simplomon.
+# simplomon_acct (user): Set user to run simplomon as.
+# Default is "www".
+# simplomon_config (path): Set to /usr/local/etc/simplomon.conf
+# by default.
+#
+
+. /etc/rc.subr
+
+name=simplomon
+rcvar=simplomon_enable
+
+load_rc_config $name
+
+: ${simplomon_enable:="NO"}
+: ${simplomon_acct:="www"}
+: ${simplomon_config:="%%PREFIX%%/etc/simplomon.conf"}
+
+pidfile="/var/run/${name}.pid"
+daemon_pidfile="/var/run/${name}-daemon.pid"
+required_files="${simplomon_config}"
+procname="%%PREFIX%%/bin/simplomon"
+
+command="/usr/sbin/daemon"
+command_args="-c -r -R 15 -f -t ${name} -T ${name} \
+ -p ${pidfile} \
+ -P ${daemon_pidfile} \
+ -u ${simplomon_acct} \
+ ${procname} ${simplomon_config}"
+
+start_precmd=simplomon_precmd
+
+simplomon_precmd()
+{
+ if [ ! -e ${pidfile} ]; then
+ install -o ${simplomon_acct} -g wheel -m 644 /dev/null ${pidfile}
+ fi
+
+ if [ ! -e ${daemon_pidfile} ]; then
+ install -o ${simplomon_acct} -g wheel -m 644 /dev/null ${daemon_pidfile}
+ fi
+}
+
+run_rc_command "$1"
diff --git a/net-mgmt/simplomon/pkg-descr b/net-mgmt/simplomon/pkg-descr
new file mode 100644
index 000000000000..6c24d72f4141
--- /dev/null
+++ b/net-mgmt/simplomon/pkg-descr
@@ -0,0 +1,6 @@
+Simplomon is a lightweight and easy-to-setup availability monitoring
+system. It offers advanced features such as certificate expiry checking,
+IPv6 autoconfiguration, DNS synchronization, DNSSEC signature freshness
+checks, HTTP redirect checking, providing a web page, JSON status, and a
+Prometheus node exporter. It is suitable for quickly setting up monitoring
+without the need for complex configuration or maintenance.