v_update_sys_rrd 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. # info: updating system rrd charts
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Importing system enviroment as we run this script
  7. # mostly by cron wich do not read it by itself
  8. source /etc/profile.d/vesta.sh
  9. # Importing variables
  10. source $VESTA/conf/vars.conf
  11. source $V_CONF/vesta.conf
  12. source $V_FUNC/shared.func
  13. # Another workaround for cron enviroment
  14. PATH="$PATH:$V_BIN"
  15. export PATH
  16. # Argument defenition
  17. period=$1
  18. #----------------------------------------------------------#
  19. # Action #
  20. #----------------------------------------------------------#
  21. # Updateing system stats
  22. $V_BIN/v_update_sys_rrd_la $period
  23. $V_BIN/v_update_sys_rrd_net $period
  24. $V_BIN/v_update_sys_rrd_mem $period
  25. $V_BIN/v_update_sys_rrd_ssh $period
  26. # Updating web stats
  27. if [ "$WEB_SYSTEM" = 'apache' ]; then
  28. $V_BIN/v_update_sys_rrd_httpd $period
  29. fi
  30. if [ "$PROXY_SYSTEM" = 'nginx' ]; then
  31. $V_BIN/v_update_sys_rrd_nginx $period
  32. fi
  33. # Updating ftp stats
  34. if [ ! -z "$FTP_SYSTEM" ] && [ "$FTP_SYSTEM" != 'no' ]; then
  35. $V_BIN/v_update_sys_rrd_ftp $period
  36. fi
  37. # Updating db stats
  38. if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
  39. for type in ${DB_SYSTEM//,/ }; do
  40. # Switching on db type
  41. case $type in
  42. mysql) $V_BIN/v_update_sys_rrd_mysql $period ;;
  43. pgsql) $V_BIN/v_update_sys_rrd_pgsql $period ;;
  44. esac
  45. done
  46. fi
  47. #----------------------------------------------------------#
  48. # Vesta #
  49. #----------------------------------------------------------#
  50. # Logging
  51. log_event 'system' "$V_EVENT"
  52. exit