root / plugins / network / windows_domain @ 17f78427
Historique | Voir | Annoter | Télécharger (678 octets)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# munin plugin to monitor the number of logged in users |
| 3 |
# and the number of hosts they're spread across on a windows domain. |
| 4 |
# uses output dump of "net sess" from the domain controller. |
| 5 |
# (c) 2011 jon@jon.bpa.nu |
| 6 |
#%# family=manual |
| 7 |
|
| 8 |
SESSIONS="/srv/pub/kram/dud" |
| 9 |
|
| 10 |
case $1 in |
| 11 |
config) |
| 12 |
cat <<CFG |
| 13 |
graph_title windows domain |
| 14 |
graph_vlabel users/hosts |
| 15 |
graph_category network |
| 16 |
users.label users |
| 17 |
hosts.label hosts |
| 18 |
CFG |
| 19 |
exit 0;; |
| 20 |
esac |
| 21 |
|
| 22 |
tail -n+5 "$SESSIONS" | head -n-2 | awk '$2 !~ "[\[\]\(\)\:;\"<>\*\+=\|\\/\?,]" { if(length($2)>=2) ua[tolower($2)] }
|
| 23 |
$1 !~ "\:" { ha[$1] }
|
| 24 |
END{ print "users.value",length(ua);
|
| 25 |
print "hosts.value",length(ha) }' 2>/dev/null |
