Sometimes you face the problem, that a software vendor depends on logged on user sessions, instead of windows services. We had the case, that a partner constantly complained, that we logged of his service user. To have a history about the logged on state, I added a Zabbix item through the possibility to add custom UserParameter. The CMD line utility
qwinsta is able to check if a specific user is logged on.
First of all, an example of the output qwinsta can give you:
marco.hofmann@XENWORKSTATION C:\Users\Marco.Hofmann > qwinsta marco.hofmann SITZUNGSNAME BENUTZERNAME ID STATUS TYP GERÄT >console marco.hofmann 1 Aktiv
marco.hofmann@XENWORKSTATION C:\Users\Marco.Hofmann > qwinsta administrator Für administrator ist keine Sitzung vorhanden
This helped me to write the Zabbix UserParameter entry:
After this I was able to get the value I need via zabbix_get:
root@zabprox:~# zabbix_get -s server.domain.local -k xenadmin.qwinsta[testuser] SITZUNGSNAME BENUTZERNAME ID STATUS TYP GERÄT rdp-tcp#5 testuser 1 Aktiv
Now I was able to create the Zabbix Item:
And this led me to the last step, the trigger expression:
Zabbix Latest Data now shows every 10 minutes the logged on state, the Trigger informs us, if the session would be logged of.