| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #!/bin/bash
- # info: update system rrd charts
- # options: period
- #
- # The script is wrapper for all rrd functions. It updates all
- # v_update_sys_rrd_* at once.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Importing system enviroment as we run this script
- # mostly by cron wich do not read it by itself
- source /etc/profile.d/vesta.sh
- # Importing variables
- source $VESTA/conf/vars.conf
- source $V_CONF/vesta.conf
- source $V_FUNC/shared.func
- # Another workaround for cron enviroment
- PATH="$PATH:$V_BIN"
- export PATH
- # Argument defenition
- period=$1
- # Checking rrddir
- if [ ! -d "$V_RRD" ]; then
- mkdir -p $V_RRD
- fi
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Updateing system stats
- $V_BIN/v_update_sys_rrd_la $period
- $V_BIN/v_update_sys_rrd_net $period
- $V_BIN/v_update_sys_rrd_mem $period
- $V_BIN/v_update_sys_rrd_ssh $period
- # Updating web stats
- if [ "$WEB_SYSTEM" = 'apache' ]; then
- $V_BIN/v_update_sys_rrd_httpd $period
- fi
- if [ "$PROXY_SYSTEM" = 'nginx' ]; then
- $V_BIN/v_update_sys_rrd_nginx $period
- fi
- # Updating ftp stats
- if [ ! -z "$FTP_SYSTEM" ] && [ "$FTP_SYSTEM" != 'no' ]; then
- $V_BIN/v_update_sys_rrd_ftp $period
- fi
- # Updating db stats
- if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
- for type in ${DB_SYSTEM//,/ }; do
- # Switching on db type
- case $type in
- mysql) $V_BIN/v_update_sys_rrd_mysql $period ;;
- pgsql) $V_BIN/v_update_sys_rrd_pgsql $period ;;
- esac
- done
- fi
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Logging
- log_event 'system' "$V_EVENT"
- exit
|