From 4af23a29df6b8e594d1f84202c6678c800cf13b3 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Mon, 3 Mar 2025 17:35:16 +0100 Subject: [PATCH] add port tcp check (requires php-sockets module --- TODO.md | 2 +- inc_vars.php | 2 +- tests/200_porttcp.php | 7 +++++++ tests/configs/porttcp.ini | 23 +++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/200_porttcp.php create mode 100644 tests/configs/porttcp.ini diff --git a/TODO.md b/TODO.md index cb6d7f8..cce8576 100644 --- a/TODO.md +++ b/TODO.md @@ -28,7 +28,7 @@ was ich so sehe ... ✅ PdoConnect ✅ Phpmodules -> funcktioniert formal, aber bei Nicht-PHP-Apps nicht relevant; getestet werden die im Binary eincomoilierten Module ✅ Ping - ⬜ PortTcp + ✅ PortTcp -> sockets Modul im Binary hinzugefügt. ⬜ Simple ⬜ SqliteConnect diff --git a/inc_vars.php b/inc_vars.php index 498f5b2..e76ddc2 100644 --- a/inc_vars.php +++ b/inc_vars.php @@ -3,7 +3,7 @@ $php_version="8.3"; // extensions - see https://static-php.dev/en/guide/extensions.html -$php_libs="mysqli,openssl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,zlib"; +$php_libs="mysqli,openssl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,sockets,zlib"; $myos=strtolower(PHP_OS); $myarchitecture="x86_64"; diff --git a/tests/200_porttcp.php b/tests/200_porttcp.php new file mode 100644 index 0000000..59acf55 --- /dev/null +++ b/tests/200_porttcp.php @@ -0,0 +1,7 @@ +#!/usr/bin/env php +<?php + +echo " +WHAT: Run check porttcp +"; +_exec("$AMCLI --ini='".__DIR__."/configs/porttcp.ini'"); diff --git a/tests/configs/porttcp.ini b/tests/configs/porttcp.ini new file mode 100644 index 0000000..225a312 --- /dev/null +++ b/tests/configs/porttcp.ini @@ -0,0 +1,23 @@ +; ======================================================================= +; +; APPMONITOR CLI CLIENT +; +; for the checks see its parameters +; <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/Plugins/Checks/index.html> +; +; ======================================================================= + + +; ----------------------------------------------------------------------- +; CHECKS +; ----------------------------------------------------------------------- + +["Ping"] +description="Check port 443 on www.example.com" +function="Porttcp" +params='{ + "port": 443, + "host": "www.example.com" +}' + +; ----------------------------------------------------------------------- -- GitLab