monitoring-plugins icon indicating copy to clipboard operation
monitoring-plugins copied to clipboard

users: incorrect calculation of count_tty

Open fabbricalox opened this issue 2 months ago • 0 comments

This issue respects the following points:

  • [x] This is a bug, not a question or a setup/configuration issue.
  • [x] This issue is not already reported on Github (I've searched it).
  • [x] I use the latest release of the Monitoring Plugins (https://github.com/Linuxfabrik/monitoring-plugins/releases).
  • [x] I agree to follow Monitoring Plugins's Code of Conduct.

Which variant of the Monitoring Plugins do you use?

  • [x] .rpm/.deb package from repo.linuxfabrik.ch
  • [ ] Compiled for Windows from download.linuxfabrik.ch
  • [x] Source Code from GitHub

Bug description

The "users" plugin reports tty's in use when a linux user did connect via ssh using ipv6 (no tty in use). This happens due to incorrect calculation of count_tty.

Steps to reproduce - Plugin call

/usr/lib64/nagios/plugins/users

Steps to reproduce - Data

Connect to destination server via ssh using ipv6. The plugin reports a warning due to colons in ipv6 addresses:

root@atomico:/usr/lib64/nagios/plugins# ./users 
TTY: 1 [WARNING], PTS: 0

USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT
clox                    2025:ff:ff0ff:f30 16:05   15:44m  0.00s   ?    sshd: fubar [priv]|'tty'=1;1;;0; 'pts'=0;20;;0;

(ipv6 address obviously obfuscated).

parse_linux_output(s) checks for presence of ":" in the w output, so the warning is wrong.

Environment

different linux machines, mostly running Ubuntu or Debian. Latest version for linuxfabrik-monitoring-plugins via repo.

Plugin Version

users: v2025080501 by Linuxfabrik GmbH, Zurich/Switzerland

Python version

Python 3.12.3

List of Python modules

No response

Additional Information

No response

fabbricalox avatar Dec 02 '25 16:12 fabbricalox