Compare commits

..

No commits in common. "3c81d6c07fe1888c72de3bfcd9fe06132960da97" and "3290c04f6bf34527e62192497872c86536419a7b" have entirely different histories.

2 changed files with 7 additions and 135 deletions

View File

@ -36,7 +36,7 @@ totalmem=`free -m | head -2 | tail -1 | awk '{print $2}'`
echo 'LA: ' $la ' of ' $nproc
echo 'RAM: ' $usedmem 'Mb of ' $totalmem Mb
echo -e "\n${TEXT_COLOR_GOOD} - Disk: ${TEXT_COLOR_OFF}\n"
echo -e "${TEXT_COLOR_GOOD} - Disk: ${TEXT_COLOR_OFF}\n"
df -h | head -n 1
df -h | grep '/dev/vd'
@ -45,7 +45,7 @@ echo "- Inodes:"
df -hi | grep '/dev/vd'
echo -e "\n${TEXT_COLOR_GOOD} - Installed panel: ${TEXT_COLOR_OFF}\n"
echo -e "\n ${TEXT_COLOR_GOOD} - Installed panel: ${TEXT_COLOR_OFF}\n"
#if zero - false
[[ -d /opt/webdir/bin/ ]] && echo "Bitrix!"
@ -66,7 +66,6 @@ echo -e "
1. Посмотреть жрущие ЦПУ/ОЗУ процессы
2. Вывести OOM'ы
3. nginx: Посмотреть конфиги и домены в них
4. Запустить logs
0. Выход
"
@ -77,11 +76,11 @@ echo -e "
harakiri
;;
1)
echo -e "${TEXT_COLOR_GOOD}- Top RAM usage:${TEXT_COLOR_OFF}"
echo "- Top RAM usage:"
ps axk-%mem ouser,%cpu,%mem,command | head
echo
echo -e "${TEXT_COLOR_GOOD}- Top CPU usage:${TEXT_COLOR_OFF}"
echo "- Top CPU usage:"
ps axk-%cpu ouser,%cpu,%mem,command | head
;;
@ -90,12 +89,7 @@ echo -e "
dmesg -T | grep "Out of memory"
;;
3)
nginx -T 2> /dev/null | egrep "configuration file|server_name"
;;
4)
wget -O /tmp/nginx.sh 94.228.126.204/nginx.sh
bash /tmp/nginx.sh
rm /tmp/nginx.sh
nginx -T | egrep "configuration file|server_name"
;;
esac
done

View File

@ -1,125 +1,3 @@
#!/bin/bash
# trap 'echo " Vyhody cherez menu"' INT
TEXT_COLOR_GOOD="\033[92m"
TEXT_COLOR_BAD="\033[91m"
TEXT_COLOR_OFF="\033[0m"
echo -e "
${TEXT_COLOR_GOOD}
__
/ /___ ____ ______
/ / __ \/ __ / ___/
/ / /_/ / /_/ (__ )
/_/\____/\__, /____/
/____/
${TEXT_COLOR_OFF}
"
menu() {
[[ -d /opt/webdir/bin/ ]] && menu_bx
[[ -d /usr/local/vesta/ ]] && menu_vesta
[[ -d /usr/local/mgr5/ ]] && menu_isp
[[ -d /usr/local/fastpanel2 ]] && menu_fastpanel
}
menu_fastpanel() {
clear
readarray -t lines < <(ls /var/www/fastuser/data/logs/ | awk -F"-" '{print $1}' | uniq )
echo "Выбери сайт:"
select c in "${lines[@]}"; do
[[ -n $c ]] || { echo "Некорректный выбор." >&2; continue; }
break
done
read -r a <<<"$c"
clear
echo -n "Для $c:
1. Access Log
2. Error Log
3. (DDoS) Количество запросов в минуту
4. DDoS Топ запросов
5. DDoS Топ IP-адресов
6. Топ user-агентов
7. Спам через форму
8. Количество запроосов по часам
9. Проверка кодов ответа
0. Выход
"
read -r b
case $b in
0)
exit ;;
1)
clear
cat /var/www/fastuser/data/logs/$c-frontend.access.log
read -p 'Для выхода в меню нажми Enter'
;;
2)
clear
cat /var/www/fastuser/data/logs/$c-frontend.error.log
read -p 'Для выхода в меню нажми Enter'
;;
3)
clear
wc -l "/var/www/fastuser/data/logs/$c-frontend.access.log"
echo "Подождем минуту..."
sleep 1m
wc -l "/var/www/fastuser/data/logs/$c-frontend.access.log"
read -p 'Для выхода в меню нажми Enter'
;;
4)
clear
cat /var/www/fastuser/data/logs/$c-frontend.access.log | awk '{print $7}' | sort | uniq -c | sort -rn | head
read -p 'Для выхода в меню нажми Enter'
;;
5)
clear
cat /var/www/fastuser/data/logs/$c-frontend.access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head
read -p 'Для выхода в меню нажми Enter'
;;
6)
cat /var/www/fastuser/data/logs/$c-frontend.access.log | awk ' {for (i = 12; i <= (NF-1); i++) printf("%s%s",$i,(i==(NF-1))?"\n":OFS)}' | sort | uniq -c |sort -rn |head
read -p 'Для выхода в меню нажми Enter'
;;
7)
clear
cat /var/www/fastuser/data/logs/$c-frontend.access.log | grep POST |awk '{print $6,$7}' | sort | uniq -c | sort -rn | head
read -p 'Для выхода в меню нажми Enter'
;;
8)
clear
cat /var/www/fastuser/data/logs/$c-frontend.access.log | awk '{print $4}' | sed 's/:[0-9][0-9]:[0-9][0-9]$//g' | uniq -c
read -p 'Для выхода в меню нажми Enter'
;;
9)
clear
cat /var/www/fastuser/data/logs/$c-frontend.access.log | awk '{print $9}' | sort | uniq -c | sort -rn | head
read -p 'Для выхода в меню нажми Enter'
;;
esac
menu_fastpanel
}
menu_bx() {
clear
echo "В процессе запила"
menu_exit
}
menu_vesta() {
clear
echo "В процессе запила"
menu_exit
}
menu_isp() {
clear
echo "В процессе запила"
menu_exit
}
menu
echo "- Sort by IP"
cat /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -hr | head -n 30