diff --git a/CHANGELOG.md b/CHANGELOG.md index fc12b4fa..ba242f2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Monitoring Plugins: * \*-version: Add new parameters `--insecure` `--no-proxy` `--timeout` * about-me: Add detection of PHP Composer +* about-me: Add detection of UDP ports * about-me: Add new parameters `--insecure` `--no-proxy` `--timeout` * about-me: Pipes ("|") within the plugin output lead to broken perfdata ([#741](https://github.com/Linuxfabrik/monitoring-plugins/issues/741)) * apache-httpd-status: Add new parameters `--no-proxy` `--timeout` diff --git a/check-plugins/about-me/README.rst b/check-plugins/about-me/README.rst index 226af771..ffa8e522 100644 --- a/check-plugins/about-me/README.rst +++ b/check-plugins/about-me/README.rst @@ -9,7 +9,7 @@ Reports an overview about the host dimensions, its network interfaces, deployed * System information (OS, CPUs, disks, ram, UEFI y/n etc.) * Python modules: Reports version of installed Python modules some of our checks depend on * Interfaces: All IPv4 network interfaces with their IP address -* Listening TCP ports +* Listening TCP and UDP ports * Software installed: Lists well-known packages installed by your package manager * Software found/guessed: Manually installed software that resides in ``/home``, ``/opt`` and ``/var/www/html`` * Tools: Admin-preferred tools like dig, vim, wget etc. - normally not installed on a minimal server system @@ -78,18 +78,24 @@ Full output example: myhostname: Fedora Linux 36 (Thirty Six) Kernel 6.2.10-100.fc36.x86_64 virtualized on kvm, OpenStack Foundation OpenStack Nova, Firmware: n/a, SerNo: 8259353c-789d-4c63-be49-e246ae23b31c, Proc: pc-i440fx-5.2, #Cores: 2, #Threads: 2, Current Speed: 2000 MHz, 4.0GiB RAM, Disk vda 20G, BIOS boot, born 2022-05-25. Features: iptables, lvm, nftables, selinux. Missing: firewalld. About-me v2023042301 - Listening TCP Ports: - * 0.0.0.0:22/tcp4 + Listening TCP/UDP Ports: * [::]:22/tcp6 + * 0.0.0.0:22/tcp4 * 127.0.0.1:25/tcp4 - * 127.0.0.54:53/tcp4 - * 127.0.0.53:53/tcp4 - * 0.0.0.0:80/tcp4 - * 0.0.0.0:443/tcp4 + * [::]:80/tcp6 + * [::]:111/tcp6 + * 0.0.0.0:111/tcp4 + * 0.0.0.0:111/udp4 + * [::]:111/udp6 + * 127.0.0.1:323/udp4 + * [::1]:323/udp6 + * [::]:443/tcp6 + * 0.0.0.0:3306/tcp4 * [::]:3306/tcp6 - * [::]:5355/tcp6 - * 0.0.0.0:5355/tcp4 * [::]:5665/tcp6 + * 127.0.0.1:6379/tcp4 + * [::1]:6379/tcp6 + * [::]:9980/tcp6 SW installed: * Apache httpd 2.4.56 diff --git a/check-plugins/about-me/about-me b/check-plugins/about-me/about-me index dd4f11e7..f2309c79 100755 --- a/check-plugins/about-me/about-me +++ b/check-plugins/about-me/about-me @@ -40,7 +40,7 @@ except ImportError: __author__ = 'Linuxfabrik GmbH, Zurich/Switzerland' -__version__ = '2024032502' +__version__ = '2024040901' DESCRIPTION = 'Reports a quick overview about the host dimensions and installed software.' @@ -1843,11 +1843,10 @@ def get_listening_ports(): nc = psutil.net_connections('inet') for c in nc: ip, port = c.laddr - if c.type == socket.SOCK_DGRAM: - # ignore udp - continue if c.type == socket.SOCK_STREAM and c.status == psutil.CONN_LISTEN: proto = 'tcp' + elif c.type == socket.SOCK_DGRAM and c.status == psutil.CONN_NONE: + proto = 'udp' else: continue if c.family == socket.AF_INET: @@ -1856,7 +1855,7 @@ def get_listening_ports(): proto += '6' result.append({ 'proto': proto, - 'ip': ip if ip != '::' else '[::]', + 'ip': '[{}]'.format(ip) if ':' in ip and not ip.startswith('[') and not ip.endswith(']') else ip, # pylint: disable=C0301 'port': port, }) return sorted(result, key=lambda d: d['port']) @@ -2245,7 +2244,7 @@ def main(): msg += 'Interfaces (IPv4):\n{}\n'.format(interfaces) if ports: - msg += 'Listening TCP Ports:\n' + msg += 'Listening TCP/UDP Ports (sorted by port):\n' for p in ports: msg += '* {}:{}/{}\n'.format(p['ip'], p['port'], p['proto']) msg += '\n'