v_update_sys_rrd 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. # Includes
  14. source $VESTA/conf/vesta.conf
  15. source $VESTA/func/shared.sh
  16. # Another workaround for cron enviroment
  17. PATH="$PATH:$BIN"
  18. export PATH
  19. # Argument defenition
  20. period=$1
  21. # Checking rrddir
  22. if [ ! -d "$RRD" ]; then
  23. mkdir -p $RRD
  24. fi
  25. #----------------------------------------------------------#
  26. # Action #
  27. #----------------------------------------------------------#
  28. # Updateing system stats
  29. $BIN/v_update_sys_rrd_la $period
  30. $BIN/v_update_sys_rrd_net $period
  31. $BIN/v_update_sys_rrd_mem $period
  32. $BIN/v_update_sys_rrd_ssh $period
  33. # Updating web stats
  34. if [ "$WEB_SYSTEM" = 'apache' ]; then
  35. $BIN/v_update_sys_rrd_httpd $period
  36. fi
  37. if [ "$PROXY_SYSTEM" = 'nginx' ]; then
  38. $BIN/v_update_sys_rrd_nginx $period
  39. fi
  40. # Updating ftp stats
  41. if [ ! -z "$FTP_SYSTEM" ] && [ "$FTP_SYSTEM" != 'no' ]; then
  42. $BIN/v_update_sys_rrd_ftp $period
  43. fi
  44. # Updating db stats
  45. if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
  46. for type in ${DB_SYSTEM//,/ }; do
  47. # Switching on db type
  48. case $type in
  49. mysql) $BIN/v_update_sys_rrd_mysql $period ;;
  50. pgsql) $BIN/v_update_sys_rrd_pgsql $period ;;
  51. esac
  52. done
  53. fi
  54. #----------------------------------------------------------#
  55. # Vesta #
  56. #----------------------------------------------------------#
  57. # Logging
  58. log_event "$OK" "$EVENT"
  59. exit