| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #!/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
- # Includes
- source $VESTA/conf/vesta.conf
- source $VESTA/func/shared.sh
- # Another workaround for cron enviroment
- PATH="$PATH:$BIN"
- export PATH
- # Argument defenition
- period=$1
- # Checking rrddir
- if [ ! -d "$RRD" ]; then
- mkdir -p $RRD
- fi
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Updateing system stats
- $BIN/v_update_sys_rrd_la $period
- $BIN/v_update_sys_rrd_net $period
- $BIN/v_update_sys_rrd_mem $period
- $BIN/v_update_sys_rrd_ssh $period
- # Updating web stats
- if [ "$WEB_SYSTEM" = 'apache' ]; then
- $BIN/v_update_sys_rrd_httpd $period
- fi
- if [ "$PROXY_SYSTEM" = 'nginx' ]; then
- $BIN/v_update_sys_rrd_nginx $period
- fi
- # Updating ftp stats
- if [ ! -z "$FTP_SYSTEM" ] && [ "$FTP_SYSTEM" != 'no' ]; then
- $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) $BIN/v_update_sys_rrd_mysql $period ;;
- pgsql) $BIN/v_update_sys_rrd_pgsql $period ;;
- esac
- done
- fi
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Logging
- log_event "$OK" "$EVENT"
- exit
|