v_update_sys_rrd 1.9 KB

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