Git Product home page Git Product logo

simplomon's Introduction

simplomon

Very simple availability monitoring system with a single configuration file and a single binary. Also comes as a Docker image.

Key differences compared to existing systems:

  • Setup in 5 minutes, no need to ever think about it anymore
  • Also check what should not work (ports that should be closed)
  • Pin certain things to how they should be (like NS records)
  • Advanced features by default
    • certificate expiry checking, full chain HTTPs check
    • IPv6 autoconfiguration with explicit tests if you and target have working IPv6
    • DNS synchronization
    • DNSSEC signature freshness checks
    • HTTP redirect checking ('www' -> '', 'http' -> 'https')
    • Prometheus node exporter integration for disk space, bandwidth, security tests
    • SMTP STARTTLS certificate checking, IMAP certificate checking
      • Email delivery test. IMAP check checks if SMTP check managed to deliver email to the configured mailbox
  • "Management mode" - (separate) alerts that only go out if a problem persists

You'd use this if you think "I need to slap some monitoring on this pronto and I can't be bothered to setup something difficult that will require maintenance or get hacked". Another usecase if you want to monitor from a vantage point where you can't install large-scale software.

You'd also use this if you appreciate some of the 'smarter' checks described above.

If you want a full featured complicated monitoring system, there is lots of choice already, and this isn't it. Also, as it stands simplomon won't scale to tens of thousands of checks.

If you miss features that just make sense, do let me know! Open an issue here please.

Important news

If you upgraded on the 12th of April 2024 and were using the SQLite logger, you need to change Logger("db.sqlite") to Logger{filename="db.sqlite"}.

Mission statement

Right now Simplomon is simple and robust. History shows it is a struggle to keep a project lean, but we're going to give it a try. Simple to use however does not imply a lack of powerful features. But it does mean:

  • Rejecting anything that means it takes more than 5 minutes for a novice to benefit from simplomon
  • Keeping the most common usecases available as one-liners
  • Not falling for premature abstraction or premature optimization
  • Making sure that any more advanced use of simplomon "grows on you", and does not get in the way of rapidly getting the first benefits
  • Adding new native tests to the code should remain as simple as possible, so we can make sure we have a useful check for your service out of the box, without having to resort to scripting/custom code.

As an example, more generic monitoring/logging solutions can also monitor DNS records through regular expressions that have to be just so. In simplomon, we'd rather have a test that out of the box checks common things really well. In other words, we want to break out custom and dynamic rules only for very rare or niche tests.

Thanks to

Many thanks are due to early adopters & contributors:

  • Wander Nauta
  • Reinoud van Leeuwen
  • Roel van der Made
  • Job Snijders
  • Axel Roest
  • GitHub user 'Calamarain'
  • Wouter Schoot

Sample configuration (without Docker)

Note that the configuration below is completely functional, you need nothing else, except a working Pushover, ntfy or Telegram account, or a mailbox. If you need another notifier, do let me know.

addPushoverNotifier{user="copy this in from pushover config",
        apikey="copy this in from pushover config"}

-- or ntfy.sh:
-- addNtfyNotifier{topic="your_secret_topic"}

-- or point to your own instance, or set the Authorization header through 'auth'
-- addNtfyNotifier{topic="your_topic", url="https://ntfy.example.net", auth="Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk"}

-- or create a Telegram bot, and direct messages to a chat both you and the bot have access to.
-- addTelegramNotifier{bot_id="your bot id",
                       apikey="your api key",
                       chat_id="the chat id"}

-- or email, in "CEO mode": only gets alerts that have been there for an hour
-- addEmailNotifier{from="[email protected]", to="[email protected]",
-- server="10.0.0.2", minMinutes = 60}

Pushover appears to work really well, and I'd prefer it to ntfy. Email meanwhile is a bit scary, since it might need the very infrastructure it monitors to send out notifications. You might never get that email.

Here are some sample checkers:

dailyChime{utcHour=10} -- 10AM UTC chime confirms monitoring works

ping{servers={"9.9.9.9", "8.8.8.8"}} -- does our network even work

-- the following checks certificates, and whines if any expire within
-- two weeks. If we have IPv6, and there are AAAA records, check that too
https{url="https://berthub.eu"}

-- save bandwidth, don't fetch the body
https{url="https://galmon.eu/", method="HEAD"}

-- This complains if that URL is older than 20 minutes
https{url="https://berthub.eu/nlelec/dutch-stack.svg", maxAgeMinutes=20}

-- check if the response body contains a regex match
https{url="https://example.org", regex="[Ee]xample [Dd]omain"}

-- check if a specific server IP is serving correctly
https{url="https://berthub.eu", serverIP="86.82.68.237"}
https{url="https://berthub.eu", serverIP="2001:41f0:782d::2"}

-- check if a URL works correctly if resolved via specific nameserver
https{url="https://berthub.eu", dns={"8.8.8.8"}}
-- or from a specific source IP
https{url="https://berthub.eu", dns={"9.9.9.9"], localIP="10.0.0.9"}

-- Check if SOA records are identical
nameservers={"100.25.31.6", "86.82.68.237", "217.100.190.174"}
dnssoa{domain="berthub.eu", servers= nameservers}
dnssoa{domain="hubertnet.nl", servers= nameservers}

-- DNSSEC, check if signatures are fresh enough
rrsig{server="45.55.10.200", name="powerdns.com"}
rrsig{server="188.166.104.87", name="powerdns.com"}
rrsig{server="149.20.2.26", name="isc.org", minDays=10}
rrsig{server="100.25.31.6", name="berthub.eu"}

-- Check if the following ports are closed
scaryports={25, 80, 110, 443, 3000, 3306, 5000, 5432, 8000, 8080, 8888}
tcpportclosed{servers={"100.25.31.6"}, ports=scaryports}

-- Check if DNS is serving what it should be
dns{server="100.25.31.6", name="berthub.eu", type="A",
	acceptable={"86.82.68.237", "217.100.190.174"}}
dns{server="100.25.31.6", name="berthub.eu", type="AAAA",
	acceptable={"2001:41f0:782d::2"}}

-- Does the http redirect work?
httpredir{fromUrl="http://berthub.eu", toUrl="https://berthub.eu/"}

-- And the www redirects?
httpredir{fromUrl="http://www.berthub.eu", toUrl="https://berthub.eu/"}
httpredir{fromUrl="https://www.berthub.eu", toUrl="https://berthub.eu/"}

-- Use the prometheus node exporter:
prometheusExp{url="http://10.0.0.1:9100/metrics", 
checks={{kind="DiskFree", mountpoint="/", gbMin=10},
        {kind="AptPending"},  -- pending security updates
        {kind="Bandwidth", device="enp2s0.9", minMbit=0.1, maxMbit=50},
        {kind="Bandwidth", device="ppp0", minMbit=0.4}
}}

-- mail delivery tests
smtp{server="10.0.0.2", servername="ziggo.berthub.eu", from="[email protected]", 
	to="[email protected]",	minCertDays=7}

-- will complain if no 'simplomon test message' messages arrive:
imap{server="10.0.0.2", servername="ziggo.berthub.eu", user="username", 
	password="secret"}

Save this as 'simplomon.conf' and start './simplomon' and you should be in business.

Webserver

If you run Webserver{address="127.0.0.1:8080"}, simplomon will launch a webserver. If you run Simplomon inside a container, you'll probably have to use 0.0.0.0:8080 for things to work.

You can also add user="something", password=... (password in quotes).

This server supports the following three endpoints. The first, '/health' is always enabled. The dashboard and other JSON endpoints only function if you supplied a user name and a password, which will be checked using basic auth.

  • /health: generates {"health":"ok"} which appears to make some Docker environments happy
  • /state: creates a JSON object of all active alerts
  • /checker-states: a largish JSON object describing the settings of all checkers & the results of the measurements they are doing

If you load / in a webserver you get a somewhat nice dashboard with metrics.

Datalogger

If you add Logger{filename="stats.sqlite3"}, simplomon will populate a SQLite database (in the file './stats.sqlite3') with lots of interesting metadata, one table per checker kind.

In addition, all alert reports will be logged in the 'reports' table, even if they did not lead to notifications.

Todo

  • Generic port open test
  • HTTP POST support
  • HTTP JSON check
  • Performance tests ("average response time past hour > 100ms")

Docker

There is an image on the Docker hub which you can pull (berthubert/simplomon).

The image will read its configuration file from the HTTPS URL supplied in the SIMPLOMON_CONFIG_URL environment variable.

Do make sure to set Webserver{address="0.0.0.0:8080"} in that configuration file, as otherwise your Docker environment may not recognize that simplomon is running.

To build the image yourself, do:

sudo docker build -f Dockerfile.full-build .

This implements a two-stage builder to create an image.

You can host the image for example on Scaleway's container service. It makes perfect sense to host your monitoring somewhere outside of your own network. Note that Scaleway sadly has no support for outgoing IPv6.

Running Docker on a server

To run the simplomon service on a Linux server it is easy to wrap a little systemd service definition around it.

  • A systemd-based Linux server is needed with root access
  • install docker
  • create the config file as /etc/simplomon.conf
  • create a systemd service definition file /etc/systemd/system/simplomon.service with these contents:
[Unit]
Description=Simplomon Monitoring Service
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker exec %n stop
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull berthubert/simplomon
ExecStart=docker run  \
    -v /etc/simplomon.conf:/simplomon.conf  \
    --name %n \
    berthubert/simplomon

[Install]
WantedBy=default.target
  • let systemd reload config with systemctl daemon-reload
  • enable the service with systemctl enable simplomon.service
  • start the service with systemctl start simplomon.service

checking if it has started correctly:

● simplomon.service - Simplomon Monitoring Service
     Loaded: loaded (/etc/systemd/system/simplomon.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Wed 2024-03-13 21:07:11 UTC; 10min ago
    Process: 368586 ExecStartPre=/usr/bin/docker exec simplomon.service stop (code=exited, status=1/FAILURE)
    Process: 368595 ExecStartPre=/usr/bin/docker rm simplomon.service (code=exited, status=0/SUCCESS)
    Process: 368624 ExecStartPre=/usr/bin/docker pull berthubert/simplomon (code=exited, status=0/SUCCESS)
    Process: 368647 ExecStart=/usr/bin/docker run -v /etc/simplomon.conf:/simplomon.conf --name simplomon.service berthubert/simplomon (code=killed, signal=KILL)
   Main PID: 368647 (code=killed, signal=KILL)

check the log with journalctl -u simplomon.service

notes

  • it is normal that the docker exec stop or the docker rm commands might fail in the status output; they are there to make sure previous instances have been stopped
  • Stopping the service might take up to a minute, since the simplomon service can sleep for some time

Compiling natively

On Debian derived systems the following works:

apt install python3-pip pkg-config libnghttp2-dev libssl-dev liblua5.3-dev xxd

In addition, the project requires a recent version of meson, which you can get with 'pip3 install meson ninja' or perhaps 'pip install meson ninja' and only if that doesn't work 'apt install meson'.

The meson in Debian bullseye is very old, and will give you a confusing error message about 'git' if you try it. If you enable bullseye-backports you can do apt install -t bullseye-backports meson and get a working one. Or use the pip version, which is also great.

Then run:

meson setup build
meson compile -C build

Distributing binaries, docker etc

To make a more portable binary, try:

LDFLAGS="-static-libstdc++ -static-libgcc" meson setup build --prefer-static
meson compile -C build/

Or even a fully static one:

LDFLAGS=-static meson setup build --prefer-static -Dbuildtype=release -Dcpp-httplib:cpp-httplib_openssl=disabled -Dcpp-httplib:cpp-httplib_brotli=disabled

meson compile -C build/

Inspiration

simplomon's People

Contributors

berthubert avatar wandernauta avatar job avatar axello avatar jpmens avatar mritzmann avatar wschoot avatar calamarain avatar

Stargazers

John avatar Suavesito avatar Aaron Barnes avatar Jo M avatar Ben Companjen avatar Vincent Murphy avatar Jira Nguyễn avatar Adnan Ahmed avatar Adrian Wyssmann avatar Jonathan Matthews avatar Florian Wilhelm avatar raffaele messuti avatar Filippo Giunchedi avatar Rudolph Bott avatar Michel Schinz avatar Royce Williams avatar Matteo Bigoi avatar Chris Wopat avatar Erik avatar René Moser avatar Raymond Kuiper avatar  avatar Stefan Schmidt avatar Faried Nawaz avatar Florian avatar Leander Janssen avatar Zhao Xiaohong avatar Jan-Klaas Kesteloot avatar Jeroen Raap  avatar Stig Dahl avatar Bart Smit avatar  avatar Luong Trung Kien avatar Joost van den Broek avatar Thomas Shone avatar  avatar Jordy Frijns avatar Uipko avatar Andreas Motl avatar  avatar Stefan de Kooter avatar Michael Vincent avatar Nikola Kovachevski avatar Peter avatar Frederic Bazin avatar Serge van Ginderachter avatar Sietse Snel avatar LouD avatar Michael Trip avatar  avatar Bas van Veen  avatar Marco de Moulin avatar Reinoud van Leeuwen avatar Samuel avatar Dave Cottlehuber avatar Josef Ježek avatar Martijn van de Streek avatar  avatar Michal Klabník avatar  avatar  avatar Deny avatar Masanori Ogino avatar  avatar Jakub Vlk avatar Michal Zuber avatar Daniel Hládek avatar  avatar NuxRo avatar Věroš Kaplan avatar julius kaiser avatar null data avatar joolybugg avatar  avatar  avatar  avatar Telsin avatar Ben Arblaster avatar Volker Janzen avatar Wolfgang Nagele avatar  avatar obsti8383 avatar Sebastian Feustel avatar Sven avatar Till! avatar Peter O'Fossey avatar  avatar

Watchers

 avatar  avatar Dave Cottlehuber avatar Bart Smit avatar John Todd avatar  avatar  avatar  avatar

simplomon's Issues

extra quote in pushover message

in my configuration I have stated https{url="https://mywebsite.com"}

When I get an alert (with Pushover) I get the alert:

https: [ipv4] Unable to retrieve URL 'https://mywebsite.com': SSL peer certificate or SSH remote key was not OK
In the (iPhone) Pushover app, the URL is a clickable link. When I click that link, the browser tries to open

https://snappass.leeuwen.net'
(including the extra ' at the end), which is not a valid URL.

netmon.cc doesn't compile on FreeBSD - netinet differences

Compilation fails on FreeBSD in netmon.cc

[1/2] Compiling C++ object simplomon.p/netmon.cc.o
FAILED: simplomon.p/netmon.cc.o 
ccache c++ -Isimplomon.p -I. -I.. -Isubprojects/cpp-httplib-0.13.1 -I../subprojects/cpp-httplib-0.13.1 -Isubprojects/simplesockets -I../subprojects/simplesockets -I/usr/local/include -I/usr/local/include/lua53 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++20 -O0 -g -pthread -DCPPHTTPLIB_OPENSSL_SUPPORT -DCPPHTTPLIB_ZLIB_SUPPORT -DCPPHTTPLIB_BROTLI_SUPPORT -MD -MQ simplomon.p/netmon.cc.o -MF simplomon.p/netmon.cc.o.d -o simplomon.p/netmon.cc.o -c ../netmon.cc
In file included from ../netmon.cc:6:
In file included from ../simplomon.hh:6:
In file included from ../notifiers.hh:3:
../sol/sol.hpp:14541:32: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
                               ^
../sol/sol.hpp:17294:32: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
                               ^
In file included from ../netmon.cc:10:
/usr/include/netinet/ip_icmp.h:110:14: error: field has incomplete type 'struct ip'
                        struct ip idi_ip;
                                  ^
/usr/include/netinet/ip_icmp.h:110:11: note: forward declaration of 'ip'
                        struct ip idi_ip;
                               ^
../netmon.cc:220:11: error: no member named 'type' in 'icmphdr'
    p.hdr.type = ICMP_ECHO;
    ~~~~~ ^
../netmon.cc:221:11: error: no member named 'un' in 'icmphdr'
    p.hdr.un.echo.id = id;
    ~~~~~ ^
../netmon.cc:222:11: error: no member named 'un' in 'icmphdr'
    p.hdr.un.echo.sequence = seq;
    ~~~~~ ^
../netmon.cc:229:11: error: no member named 'checksum' in 'icmphdr'
    p.hdr.checksum = 0;
    ~~~~~ ^
../netmon.cc:230:11: error: no member named 'checksum' in 'icmphdr'
    p.hdr.checksum = internetchecksum(&p, sizeof(p));
    ~~~~~ ^
../netmon.cc:251:73: error: member access into incomplete type 'struct iphdr'
    struct icmphdr* icmp = (struct icmphdr*) ((char*)packet.c_str() + ip->ihl*4);
                                                                        ^
../netmon.cc:250:12: note: forward declaration of 'iphdr'
    struct iphdr *ip = (iphdr*)packet.c_str();
           ^
../netmon.cc:253:16: error: no member named 'un' in 'icmphdr'
    id = icmp->un.echo.id;
         ~~~~  ^
../netmon.cc:254:17: error: no member named 'un' in 'icmphdr'
    seq = icmp->un.echo.sequence;
          ~~~~  ^
../netmon.cc:256:31: error: member access into incomplete type 'struct iphdr'
    payload = packet.substr(ip->ihl*4 + sizeof(icmp));
                              ^
../netmon.cc:250:12: note: forward declaration of 'iphdr'
    struct iphdr *ip = (iphdr*)packet.c_str();
           ^
2 warnings and 10 errors generated.
ninja: build stopped: subcommand failed.

Add ping test

Please add a ping test that allows:

  • Should pass/should fail
  • Source address/interface
  • Specifying IPv6/IPv4

This is to test firewall configurations (making sure things that shouldn't work, aren't working, and the inverse).

"identical" alerts should not lead to revoking the old alert

As a simple example, dailyChime issues a new chime every day. This leads to a notification that the old chime is over. And then there is the new one. This is silly. We should have an identifier that says this is still the same alert, and that there is no need to announce that the old one was over.

This could happen with an explicit alert key perhaps.

Check disk usage, potentially via SSH?

Hi,

I'm not sure if this falls into an area you would be interested in for simplemon. I recently was looking for a lean way to monitor my SMTP VPS (vCPU, 1GB RAM). I mainly wanted to make sure I dont run out of (very limited) disk space and couldn't find anything really small. I ended up with very slimmed down netdata that is sending the data to another beefier server. But it's still the biggest process on the VPS. I don't need no graphs or CPU usage or whatever else netdata provides, just a notification if the disk space is over 85%.

I think setting up an SSH key and adding the check config should be doable in 5mins, so maybe it's a feature request you might consider. Thanks!

HTTP endpoint and HTTP redir check are vulnerable to Brotli ("zip") bombs if Brotli support is enabled

The recently added HTTP endpoint as well as the HTTP redirection check are vulnerable to the same issue as Trifecta when it comes to accepting crafted requests and responses with a Brotli Content-Encoding, a feature that is enabled by default if simplomon is compiled on a machine that has Brotli headers present.

Again, taking an example file from here and bunzipping it, we have a small Brotli file that uncompresses to a large amount of data. When we send this file, either as part of a request to the status endpoint or as a response to a redir check, simplomon will attempt to allocate enough memory to hold the result, which exceeds the amount of available memory. The exact behavior is somewhat system-dependent, but on my machine this triggers the OOM killer, which then kills the simplomon process.

% /tmp › curl -v -H 'Content-Encoding: br' --data-binary @10GB.html.br http://127.0.0.1:8080/health
*   Trying 127.0.0.1:8080...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /health HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/8.0.1
> Accept: */*
> Content-Encoding: br
> Content-Length: 27036
> Content-Type: application/x-www-form-urlencoded
> 
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

For the redir check, the following configuration allocates 10GB of memory:

httpredir{fromUrl="http://demo.52-7-242-28.nip.io", toUrl="http://example.com/"}

A possible mitigation would be the same as on the Trifecta side, that is, to disable Brotli support entirely. For simplomon, it seems unlikely that either requests or responses would benefit from compression at all.

In general, it might be sensible to document (perhaps in the README) whether it is expected that simplomon instances be available from the internet, and if not, perhaps bind to the loopback interface instead of 0.0.0.0.

feature request: check dane records against smtp tls cert

As SMTP STARTTLS checks are on the roadmap, and there is infrastructure to query DNS, maybe it makes sense to add the option to validate that the certificate offered in SMTP STARTTLS matches the DANE records to the roadmap as well.

To reduce implementation effort, maybe limit it to the sane subset of DANE, so options 3 / 1 / 1 as advised in https://github.com/internetstandards/toolbox-wiki/blob/main/DANE-for-SMTP-how-to.md#publishing-dane-records

Doesn't compile on FreeBSD without help (Doctest)

Hello,

I'm trying to get this to compile on FreeBSD (having never used meson/C++/etc before) and have managed to get it to work if I add:

incdir = include_directories('/usr/local/include/doctest')

and modify the testrunner executable() to include the include_directories

executable('testrunner', 'testrunner.cc', 'notifiers.cc', 'minicurl.cc', 'dnsmon.cc', 'record-types.cc', 
              'dnsmessages.cc', 'dns-storage.cc', 'netmon.cc', 'luabridge.cc',
       dependencies: [doctest_dep, curl_dep, json_dep, fmt_dep, cpphttplib, simplesockets_dep,
              lua_dep],
       include_directories: incdir)

Is this something that can be added in a portable way? Maybe something like:

if host_machine.system() in ['freebsd']
  incdir = include_directories('/usr/local/include/doctest')
  executable('testrunner', 'testrunner.cc', 'notifiers.cc', 'minicurl.cc', 'dnsmon.cc', 'record-types.cc', 'dnsmessages.cc', 'dns-storage.cc', 'netmon.cc', 'luabridge.cc',
        dependencies: [doctest_dep, curl_dep, json_dep, fmt_dep, cpphttplib, simplesockets_dep, lua_dep],
        include_directories: incdir)
else
  executable('testrunner', 'testrunner.cc', 'notifiers.cc', 'minicurl.cc', 'dnsmon.cc', 'record-types.cc', 'dnsmessages.cc', 'dns-storage.cc', 'netmon.cc', 'luabridge.cc',
        dependencies: [doctest_dep, curl_dep, json_dep, fmt_dep, cpphttplib, simplesockets_dep, lua_dep])
endif

Unexpected response from SMTP server

Simplomon reports the following exception when it attempts to connect to my Postfix mail server:

Got an exception during check: Unexpected response from SMTP server: '503 5.5.1 Error: send HELO/EHLO first

I am willing to provide credentials to a test account if needed for troubleshooting.

warnings about unused variable during compile

Using build b14b8d4

ninja: Entering directory `/home/roel/tools/simplomon/build'
[1/16] Compiling C++ object simplomon.p/minicurl.cc.o
../minicurl.cc: In member function ‘void MiniCurl::setupURL(const string&, const ComboAddress*, const ComboAddress*)’:
../minicurl.cc:122:9: warning: unused variable ‘ret’ [-Wunused-variable]
  122 |     int ret = curl_easy_setopt(d_curl, CURLOPT_INTERFACE, src->toString().c_str());
      |         ^~~
[5/16] Compiling C++ object testrunner.p/minicurl.cc.o
../minicurl.cc: In member function ‘void MiniCurl::setupURL(const string&, const ComboAddress*, const ComboAddress*)’:
../minicurl.cc:122:9: warning: unused variable ‘ret’ [-Wunused-variable]
  122 |     int ret = curl_easy_setopt(d_curl, CURLOPT_INTERFACE, src->toString().c_str());
      |         ^~~
[16/16] Linking target testrunner

Add file test with regexp

I mentioned this recently on the Fediverse, and now as a reminder. What I'd like to see is for simplomon being able to verify whether a particular file is on the file system, and check preferable via a regexp I specify if a string is contained therein.

Regexp check can also be useful on, say, https checks to determine whether a particular string or expression is contained in whatever the check responds with.

Add pong test -- alive reporting from simplomon

I'd like to see simplomon being able to inform me via notifyer that it's alive, and since ping checks other servers, maybe pong (inspired from Ansible's ping which reponds with pong) could do so with a configurable interval, e.g. 3600 seconds.

Ubuntu 20.04: compilation failed in `testrunner`

On Ubuntu 20.04, meson compile -C build/ fails in testrunner on 3 separate files.

As instructed, I'm using meson from pip, because meson on Ubuntu 20.04 has version 0.53.2

$ git lg | head -n 1
* b8b4ecc - (HEAD -> main, origin/main, origin/HEAD) remove prometheus command for now to fix build (5 days ago) <bert hubert>
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip3 install meson ninja
(venv) $ meson --version
1.4.0
(venv) $ ninja --version
1.11.1.git.kitware.jobserver-1
(venv) $ meson setup build
[..]
simplomon undefined

  Subprojects
    cpp-httplib  : YES 3 warnings
    curl         : YES 1 warnings
    doctest      : YES
    fmt          : YES
    nlohmann_json: YES
    simplesockets: YES
    sqlitewriter : YES

Found ninja-1.11.1.git.kitware.jobserver-1 at /home/gerdriaan/scm/simplomon/venv/bin/ninja
(venv) $ meson compile -C build/ | tee -a /tmp/simplomon-compilelog
[..]
[175/214] Compiling C++ object subprojects/sqlitewriter/demo.p/demo.cc.o
[176/214] Compiling C++ object subprojects/simplesockets/testrunner.p/sclasses.cc.o
[177/214] Compiling C++ object subprojects/sqlitewriter/libsqlitewriter.a.p/jsonhelper.cc.o
[178/214] Compiling C++ object subprojects/sqlitewriter/demo.p/jsonhelper.cc.o
[179/214] Compiling C++ object subprojects/simplesockets/testrunner.p/swrappers.cc.o
[180/214] Compiling C++ object subprojects/sqlitewriter/testrunner.p/jsonhelper.cc.o
[181/214] Compiling C++ object subprojects/sqlitewriter/testrunner.p/testrunner.cc.o
ninja: build stopped: subcommand failed.
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /home/gerdriaan/scm/simplomon/venv/bin/ninja -C /home/gerdriaan/scm/simplomon/build
(venv) $

Excerpt from one error:

[172/214] Compiling C++ object subprojects/sqlitewriter/testrunner.p/sqlwriter.cc.o
FAILED: subprojects/sqlitewriter/testrunner.p/sqlwriter.cc.o 
c++ -Isubprojects/sqlitewriter/testrunner.p -Isubprojects/sqlitewriter -I../subprojects/sqlitewriter -I../subprojects/nlohmann_json-3.11.2/single_include -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -O0 -g -pthread -MD -MQ subprojects/sqlitewriter/testrunner.p/sqlwriter.cc.o -MF subprojects/sqlitewriter/testrunner.p/sqlwriter.cc.o.d -o subprojects/sqlitewriter/testrunner.p/sqlwriter.cc.o -c ../subprojects/sqlitewriter/sqlwriter.cc
../subprojects/sqlitewriter/sqlwriter.cc: In member function ‘void MiniSQLite::execPrep(const string&, std::vector<std::unordered_map<std::__cxx11::basic_string<char>, std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t> > >*)’:
../subprojects/sqlitewriter/sqlwriter.cc:134:94: error: no match for ‘operator=’ (operand types are ‘std::unordered_map<std::__cxx11::basic_string<char>, std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t> >::mapped_type’ {aka ‘std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>’} and ‘sqlite3_int64’ {aka ‘long long int’})
  134 |           row[sqlite3_column_name(d_stmts[table], n)]= sqlite3_column_int64(d_stmts[table], n);
      |                                                                                              ^
In file included from ../subprojects/sqlitewriter/sqlwriter.hh:5,
                 from ../subprojects/sqlitewriter/sqlwriter.cc:1:
/usr/include/c++/9/variant:1299:16: note: candidate: ‘std::variant<_Types>& std::variant<_Types>::operator=(const std::variant<_Types>&) [with _Types = {double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t}]’
 1299 |       variant& operator=(const variant&) = default;
      |                ^~~~~~~~
/usr/include/c++/9/variant:1299:26: note:   no known conversion for argument 1 from ‘sqlite3_int64’ {aka ‘long long int’} to ‘const std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>&’
 1299 |       variant& operator=(const variant&) = default;
      |                          ^~~~~~~~~~~~~~
/usr/include/c++/9/variant:1300:16: note: candidate: ‘std::variant<_Types>& std::variant<_Types>::operator=(std::variant<_Types>&&) [with _Types = {double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t}]’
 1300 |       variant& operator=(variant&&) = default;
      |                ^~~~~~~~
/usr/include/c++/9/variant:1300:26: note:   no known conversion for argument 1 from ‘sqlite3_int64’ {aka ‘long long int’} to ‘std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>&&’
 1300 |       variant& operator=(variant&&) = default;
      |                          ^~~~~~~~~
/usr/include/c++/9/variant:1362:2: note: candidate: ‘template<class _Tp> std::enable_if_t<((__exactly_once<std::variant<_Types>::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type> > && is_constructible_v<std::variant<_Types>::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type>, _Tp>) && is_assignable_v<std::variant<_Types>::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type>&, _Tp>), std::variant<_Types>&> std::variant<_Types>::operator=(_Tp&&) [with _Tp = _Tp; _Types = {double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t}]’
 1362 |  operator=(_Tp&& __rhs)
      |  ^~~~~~~~
/usr/include/c++/9/variant:1362:2: note:   template argument deduction/substitution failed:
/usr/include/c++/9/variant: In substitution of ‘template<class ... _Types> template<class _Tp, class> using __accepted_type = std::variant<_Types>::__to_type<__accepted_index<_Tp> > [with _Tp = long long int&&; <template-parameter-2-2> = std::enable_if<true, void>::type; _Types = {double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t}]’:
/usr/include/c++/9/variant:1358:14:   required by substitution of ‘template<class _Tp> std::enable_if_t<((__exactly_once<std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type> > && is_constructible_v<std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type>, _Tp>) && is_assignable_v<std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type>&, _Tp>), std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>&> std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>::operator=<_Tp>(_Tp&&) [with _Tp = long long int]’
../subprojects/sqlitewriter/sqlwriter.cc:134:94:   required from here
/usr/include/c++/9/variant:1276:8: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
 1276 |  using __accepted_type = __to_type<__accepted_index<_Tp>>;
      |        ^~~~~~~~~~~~~~~

Two other failures, but full log omitted for brevity:

[173/214] Compiling C++ object subprojects/sqlitewriter/libsqlitewriter.a.p/sqlwriter.cc.o
FAILED: subprojects/sqlitewriter/libsqlitewriter.a.p/sqlwriter.cc.o 
c++ -Isubprojects/sqlitewriter/libsqlitewriter.a.p -Isubprojects/sqlitewriter -I../subprojects/sqlitewriter -I../subprojects/nlohmann_json-3.11.2/single_include -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -O0 -g -fPIC -pthread -MD -MQ subprojects/sqlitewriter/libsqlitewriter.a.p/sqlwriter.cc.o -MF subprojects/sqlitewriter/libsqlitewriter.a.p/sqlwriter.cc.o.d -o subprojects/sqlitewriter/libsqlitewriter.a.p/sqlwriter.cc.o -c ../subprojects/sqlitewriter/sqlwriter.cc
../subprojects/sqlitewriter/sqlwriter.cc: In member function ‘void MiniSQLite::execPrep(const string&, std::vector<std::unordered_map<std::__cxx11::basic_string<char>, std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t> > >*)’:
../subprojects/sqlitewriter/sqlwriter.cc:134:94: error: no match for ‘operator=’ (operand types are ‘std::unordered_map<std::__cxx11::basic_string<char>, std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t> >::mapped_type’ {aka ‘std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>’} and ‘sqlite3_int64’ {aka ‘long long int’})
  134 |           row[sqlite3_column_name(d_stmts[table], n)]= sqlite3_column_int64(d_stmts[table], n);
      |                                                                                              ^
[174/214] Compiling C++ object subprojects/sqlitewriter/demo.p/sqlwriter.cc.o
FAILED: subprojects/sqlitewriter/demo.p/sqlwriter.cc.o 
c++ -Isubprojects/sqlitewriter/demo.p -Isubprojects/sqlitewriter -I../subprojects/sqlitewriter -I../subprojects/nlohmann_json-3.11.2/single_include -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -O0 -g -pthread -MD -MQ subprojects/sqlitewriter/demo.p/sqlwriter.cc.o -MF subprojects/sqlitewriter/demo.p/sqlwriter.cc.o.d -o subprojects/sqlitewriter/demo.p/sqlwriter.cc.o -c ../subprojects/sqlitewriter/sqlwriter.cc
../subprojects/sqlitewriter/sqlwriter.cc: In member function ‘void MiniSQLite::execPrep(const string&, std::vector<std::unordered_map<std::__cxx11::basic_string<char>, std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t> > >*)’:
../subprojects/sqlitewriter/sqlwriter.cc:134:94: error: no match for ‘operator=’ (operand types are ‘std::unordered_map<std::__cxx11::basic_string<char>, std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t> >::mapped_type’ {aka ‘std::variant<double, long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> >, std::nullptr_t>’} and ‘sqlite3_int64’ {aka ‘long long int’})
  134 |           row[sqlite3_column_name(d_stmts[table], n)]= sqlite3_column_int64(d_stmts[table], n);
      |                                                                                              ^

This looks similar to #5, except it's on Linux.

Currently installed dependency versions:

$ apt search '^(python3-pip|pkg-config|libnghttp2-dev|libssl-dev|liblua5.3-dev)' 2>/dev/null | grep -ie 'upgradable' -e 'install'
liblua5.3-dev/focal,now 5.3.3-1.1ubuntu2 amd64 [installed]
libnghttp2-dev/focal-updates,focal-security,now 1.40.0-1ubuntu0.2 amd64 [installed]
libssl-dev/focal-updates,focal-security 1.1.1f-1ubuntu2.22 amd64 [upgradable from: 1.1.1f-1ubuntu2.19]
pkg-config/focal,now 0.29.1-0ubuntu4 amd64 [installed,automatic]
python3-pip/focal-updates,focal-security 20.0.2-5ubuntu1.10 all [upgradable from: 20.0.2-5ubuntu1.9]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.