Hi,
I've created a quick&dirty script/template to monitor the current number of logged in users/sessions. Values are directly read via soap-request, but performance is quite bad, because 5 requests are done. I don't want to write the values into a text file because of preventing errors.
Perl-Script:
UserParameter:
sudoers-File:
Items:
zimbra.users[Sessions]
zimbra.users[imapAccounts]
zimbra.users[soapAccounts]
zimbra.users[imapSessions]
zimbra.users[soapSessions]
Admin-Sessions and Accounts would also be possible, but I don't need it.
There are more values I will try later: [1].
Any comments are welcome.
Regards,
Stefan
[0]: http://wiki.zimbra.com/wiki/Zmsoap#A...essionsRequest
[1]: http://wiki.zimbra.com/wiki/Zmsoap#Collect_server_stats
I've created a quick&dirty script/template to monitor the current number of logged in users/sessions. Values are directly read via soap-request, but performance is quite bad, because 5 requests are done. I don't want to write the values into a text file because of preventing errors.
Perl-Script:
Code:
#!/usr/bin/perl
# /opt/zabbix/scripts/zimbraUsers.pl
# Collect number of current users/sessions
use XML::Simple;
use Data::Dumper;
$parm = $ARGV[0];
$xml = new XML::Simple;
# get data via soap-request
$xmldata = `/bin/su -c 'zmsoap -z -t admin DumpSessionsRequest' - zimbra`;
$data = $xml->XMLin($xmldata);
if ($parm eq "Sessions") {
print $data->{activeSessions};
}
if ($parm eq "soapAccounts") {
print $data->{soap}{activeSessions};
}
if ($parm eq "soapSessions") {
print $data->{soap}{activeSessions};
}
if ($parm eq "imapAccounts") {
print $data->{imap}{activeAccounts};
}
if ($parm eq "imapSessions") {
print $data->{imap}{activeSessions};
}
Code:
UserParameter=zimbra.users[*],/usr/bin/sudo /opt/zabbix/scripts/zimbraUsers.pl $1
Code:
#Zabbix zabbix ALL=(ALL) NOPASSWD:/opt/zabbix/scripts/zimbraUsers.pl
zimbra.users[Sessions]
zimbra.users[imapAccounts]
zimbra.users[soapAccounts]
zimbra.users[imapSessions]
zimbra.users[soapSessions]
Admin-Sessions and Accounts would also be possible, but I don't need it.
There are more values I will try later: [1].
Any comments are welcome.
Regards,
Stefan
[0]: http://wiki.zimbra.com/wiki/Zmsoap#A...essionsRequest
[1]: http://wiki.zimbra.com/wiki/Zmsoap#Collect_server_stats
Comment