[monitoring-plugins] check_users: Use sd_get_uids instead of ...

Lorenz Kästle git at monitoring-plugins.org
Mon Aug 11 23:30:12 CEST 2025


 Module: monitoring-plugins
 Branch: master
 Commit: fb39f96ac6f72bb56d17f3e8694134dfea9186e9
 Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
   Date: Mon Aug 11 21:49:20 2025 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=fb39f96a

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.

---

 plugins/check_users.d/users.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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() {
 
 	// Test whether we booted with systemd
 	if (sd_booted() > 0) {
-		int users = sd_get_sessions(NULL);
+		int users = sd_get_uids(NULL);
 		if (users >= 0) {
 			// Success
 			result.users = users;



More information about the Commits mailing list