blob: a8b64909f2fe0acbfb17f022282cc35edef24d0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/bash
# Script qui met en forme des données d'un serveur zimbra au format influxdb
# Ce script est éxecuté une fois par heure
OUTPUT_LINE="zimbra_one_per_hour "
##############################################################
## Nombre total de compte
##############################################################
nb_total=$(echo 'select count(id) from mailbox;' | /opt/zimbra/bin/mysql zimbra | sed -n 2p)
OUTPUT_LINE+="zimbra_number_of_account=\"$nb_total\","
##############################################################
## Quota des comptes sur la license zxsuite
##############################################################
ZXS=/opt/zimbra/bin/zxsuite
if [ -f "$ZXS" ]; then
zxsuite_licensed_users=$(sudo -u zimbra $ZXS core getLicenseInfo | grep licensedUsers | awk '{print $2}')
else
zxsuite_licensed_users="No Zxsuite"
fi
OUTPUT_LINE+="zxsuite_licensed_users=\"$zxsuite_licensed_users\","
##############################################################
## Quota des comptes mobile sur la license zxsuite
##############################################################
ZXS=/opt/zimbra/bin/zxsuite
if [ -f "$ZXS" ]; then
zxsuite_licensed_mobile_users=$(sudo -u zimbra $ZXS core getLicenseInfo | grep ZxMobile -A 1 | tail -n1 | awk '{print $2}')
else
zxsuite_licensed_mobile_users="No Zxsuite"
fi
OUTPUT_LINE+="zxsuite_licensed_mobile_users=\"$zxsuite_licensed_mobile_users\","
##############################################################
## Date d'expiration de la license zxsuite
##############################################################
ZXS=/opt/zimbra/bin/zxsuite
if [ -f "$ZXS" ]; then
zxsuite_expirate_date=$(sudo -u zimbra $ZXS core getLicenseInfo | grep dateEnd | awk '{print $2,$3,$4}')
else
zxsuite_expirate_date="No Zxsuite"
fi
OUTPUT_LINE+="zxsuite_expirate_date=\"$zxsuite_expirate_date\","
##############################################################
## Date du dernier backup zxsuite
##############################################################
ZXS=/opt/zimbra/bin/zxsuite
if [ -f "$ZXS" ]; then
zxsuite_backup_lastScan=$(sudo -u zimbra $ZXS backup getBackupInfo |grep lastScan | awk '{print $2,$3,$4}')
else
zxsuite_backup_lastScan="No Zxsuite"
fi
OUTPUT_LINE+="zxsuite_backup_lastScan=\"$zxsuite_backup_lastScan\""
##############################################################
## Fin du script
##############################################################
echo "$OUTPUT_LINE"
|