readd directory
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# Script qui met en forme des données d'un serveur zimbra au format influxdb
|
||||
# Ce script est éxecuté une fois par jour
|
||||
|
||||
OUTPUT_LINE="zimbra_one_per_day "
|
||||
|
||||
##############################################################
|
||||
## Info de Version
|
||||
##############################################################
|
||||
version_install_full=$(dpkg -s zimbra-patch | egrep '^Version:' | sed -e 's/Version: //')
|
||||
version_install_array=(${version_install_full//./ })
|
||||
release=${version_install_array[0]}.${version_install_array[1]}.${version_install_array[2]}
|
||||
patch=${version_install_array[4]}
|
||||
edition=$([ -e "/opt/zimbra/bin/zmbackupquery" ] && echo NETWORK || echo FOSS)
|
||||
|
||||
OUTPUT_LINE+="release=\"$release\",edition=\"$edition\",patch=\"$patch\","
|
||||
|
||||
##############################################################
|
||||
## Récup les 5 plus gros compte
|
||||
##############################################################
|
||||
top5_biggest_account=$(echo "select comment,size_checkpoint from mailbox order by size_checkpoint desc limit 5;" | /opt/zimbra/bin/mysql zimbra)
|
||||
|
||||
OUTPUT_LINE+="top5_biggest_account=\"$top5_biggest_account\","
|
||||
|
||||
##############################################################
|
||||
## Le nombre de serveurs
|
||||
##############################################################
|
||||
zimbra_number_of_servers=$(sh -c "/opt/zimbra/bin/zmprov gas |wc -l")
|
||||
|
||||
OUTPUT_LINE+="zimbra_number_of_servers=\"$zimbra_number_of_servers\","
|
||||
|
||||
##############################################################
|
||||
## Le nombre de domaines
|
||||
##############################################################
|
||||
zimbra_number_of_domain=$(sh -c "/opt/zimbra/bin/zmprov gad |wc -l")
|
||||
|
||||
OUTPUT_LINE+="zimbra_number_of_domain=\"$zimbra_number_of_domain\","
|
||||
|
||||
##############################################################
|
||||
## Total de compte admin
|
||||
##############################################################
|
||||
nb_admin_total=$(sh -c "/opt/zimbra/bin/zmprov gaaa |wc -l")
|
||||
|
||||
OUTPUT_LINE+="zimbra_number_of_administrator=\"$nb_admin_total\","
|
||||
|
||||
##############################################################
|
||||
## Total de liste de diffusion
|
||||
##############################################################
|
||||
zimbra_number_of_list=$(sh -c "/opt/zimbra/bin/zmprov gadl |wc -l")
|
||||
|
||||
OUTPUT_LINE+="zimbra_number_of_list=\"$zimbra_number_of_list\","
|
||||
|
||||
##############################################################
|
||||
## Nombre de compte supprimé
|
||||
##############################################################
|
||||
zimbra_account_closed=$(sh -c "/opt/zimbra/bin/zmprov searchAccounts zimbraAccountStatus=*closed* | wc -l")
|
||||
|
||||
OUTPUT_LINE+="zimbra_account_closed=\"$zimbra_account_closed\","
|
||||
|
||||
##############################################################
|
||||
## Info certificat ssl
|
||||
##############################################################
|
||||
zimbra_crt_info=$(sh -c "sudo -u telegraf sudo -u zimbra /opt/zimbra/bin/zmcertmgr viewdeployedcrt")
|
||||
|
||||
OUTPUT_LINE+="zimbra_crt_info=\"$zimbra_crt_info\""
|
||||
|
||||
|
||||
##############################################################
|
||||
## Fin du script
|
||||
##############################################################
|
||||
echo "$OUTPUT_LINE"
|
||||
@@ -0,0 +1,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"
|
||||
Reference in New Issue
Block a user