summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-11 21:49:20 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-11 21:49:20 +0200
commitfb39f96ac6f72bb56d17f3e8694134dfea9186e9 (patch)
treeaf008b4d92b42404d16b8fb687530ab73b969eb9
parent4a0e309f9f5a85af6087e3eb7034a98dd410c6f7 (diff)
downloadmonitoring-plugins-fb39f96a.tar.gz
check_users: Use sd_get_uids instead of sd_get_session
Previously check_users in combination with systemd used sd_get_sessions (3) to aquire the number of users, probably with the idea that every users opens a session. Turns out, that a user can have multiple sessions and we only really want to know how many users there are. This commit changes to sd_get_uids (3) to achieve that target.
-rw-r--r--plugins/check_users.d/users.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/check_users.d/users.c b/plugins/check_users.d/users.c
index 95c05d6f..a8b168a0 100644
--- a/plugins/check_users.d/users.c
+++ b/plugins/check_users.d/users.c
@@ -61,7 +61,7 @@ get_num_of_users_wrapper get_num_of_users_systemd() {
61 61
62 // Test whether we booted with systemd 62 // Test whether we booted with systemd
63 if (sd_booted() > 0) { 63 if (sd_booted() > 0) {
64 int users = sd_get_sessions(NULL); 64 int users = sd_get_uids(NULL);
65 if (users >= 0) { 65 if (users >= 0) {
66 // Success 66 // Success
67 result.users = users; 67 result.users = users;