summaryrefslogtreecommitdiff
path: root/net-mgmt/simplomon/files
diff options
context:
space:
mode:
Diffstat (limited to 'net-mgmt/simplomon/files')
-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
5 files changed, 121 insertions, 0 deletions
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"