Skip to content

users: incorrect calculation of count_tty #989

@fabbricalox

Description

@fabbricalox

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

  • .rpm/.deb package from repo.linuxfabrik.ch
  • Compiled for Windows from download.linuxfabrik.ch
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions