Compare commits

..

41 Commits

Author SHA1 Message Date
093d0fa56a Software fix
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-17 22:31:13 +03:00
eca352baab Software: qemu-ga check
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-17 22:30:32 +03:00
32f03ed5dc Speedup playbook
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-17 22:25:46 +03:00
d688810304 Speedup playbook
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-17 22:24:45 +03:00
0e8662c390 Check software
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-17 22:24:07 +03:00
501f2be89e Check software
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-17 22:22:27 +03:00
9d6b6a7afc Больше негде тестить. Пушим сразу в прод
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-17 22:05:31 +03:00
555358a851 More OOB actions
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone Build was killed
2022-01-13 13:49:13 +00:00
3c81d6c07f Логи
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 12:44:47 +00:00
14a03d53b8 kawaii 2022-01-13 12:04:17 +00:00
696a047e32 remove "nginx: configuration is ok" 2022-01-13 12:00:21 +00:00
3290c04f6b nginx: Посмотреть конфиги и домены в них+LA
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 11:57:57 +00:00
8da6e9dbdf newline 2022-01-13 11:47:28 +00:00
e7513a4060 Fix colors
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 05:14:30 +00:00
2be9029fb7 more colors
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 05:09:56 +00:00
efc081b0f0 show distro
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 05:06:00 +00:00
0047a536e9 colored banner
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 04:49:57 +00:00
b4b4ecbfd0 beautiful
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 04:46:30 +00:00
3829104b72 Menu
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 04:13:34 +00:00
9018dcb213 br
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 03:29:53 +00:00
4c9150ea79 figlet
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-13 03:24:53 +00:00
cb74515424 sorry
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-09 20:59:54 +00:00
51e8245a4e А сейчас то работает?
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-09 20:52:30 +00:00
2db3f6afbe fix? 2022-01-09 20:50:01 +00:00
36df562007 asdf 2022-01-09 20:48:15 +00:00
334c4b083c index.html template 2022-01-09 20:47:32 +00:00
bcbc0924bb Run test on any event except promote
All checks were successful
continuous-integration/drone Build is passing
2022-01-09 20:39:44 +00:00
78acedc2d9 test
All checks were successful
continuous-integration/drone Build is passing
2022-01-09 20:37:32 +00:00
d9a58f5455 Merge pull request 'nginx-logs' (#2) from nginx-logs into master
Reviewed-on: http://git.lulzette.ru/lulzette/useful-scripts-helpdesk/pulls/2
2022-01-09 23:34:11 +03:00
eed6cc73a6 nginx logs 2022-01-09 20:31:42 +00:00
da6419167a Minimized 2022-01-09 20:27:19 +00:00
6b411698f2 Поправил ноду для теста
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-04 05:22:14 +00:00
bc0cd0450c Workaround
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-03 15:34:43 +00:00
89f527a06c Добавил публичный тест (чтобы проверять из внешнего мира)
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is failing
2022-01-03 15:24:21 +00:00
436c38d8bc Merge pull request 'Merge test' (#1) from test into master
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Reviewed-on: http://git.lulzette.ru/lulzette/useful-scripts-helpdesk/pulls/1
2022-01-03 17:27:23 +03:00
f72185ba59 Добавил деплой на тест и прод
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
continuous-integration/drone/pr Build is passing
2022-01-03 14:23:41 +00:00
6147b44d34 Поправил ссыль
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-03 08:29:51 +00:00
18e8163a7a Добавил деплой в тестовое окружение
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-03 08:26:26 +00:00
25c2af3139 Я слепой
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-01 05:26:43 +00:00
c499eb8bdb Добавил индексный файл
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-01 05:25:34 +00:00
370aa5ff4b Запускаем деплой на конкретном раннере
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-01-01 04:44:39 +00:00
6 changed files with 231 additions and 40 deletions

View File

@ -1,7 +1,7 @@
---
kind: pipeline
type: exec
name: default
name: deploy to prod
steps:
- name: Check playbook
@ -11,3 +11,6 @@ steps:
- name: Run playbook
commands:
- ansible-playbook playbook.yml
node:
target: shell-scripts

View File

@ -4,53 +4,27 @@ pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
##
# Virtual Host Configs
##
server {
listen 80 default_server;
listen [::]:80 default_server;

View File

@ -6,8 +6,7 @@
become: yes
apt:
name: nginx-light
update_cache: yes
state: latest
state: present
- name: Create dir
file:
path: /var/www
@ -21,6 +20,14 @@
group: www-data
with_fileglob:
- src/*
- name: Copy index file
become: yes
template:
src: template/index.jinja2
dest: /var/www/index.html
owner: www-data
group: www-data
mode: 0644
- name: Copy config file
become: yes
copy:
@ -32,6 +39,7 @@
handlers:
- name: Reload nginx
become: yes
ignore_errors: yes
service:
name: nginx
state: restarted

View File

@ -1,16 +1,42 @@
#!/bin/bash
echo "- Load:"
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}
"
harakiri() {
printf "${TEXT_COLOR_BAD}Committing *roskomnadzor*...${TEXT_COLOR_OFF}\n"
if [[ "$HOSTNAME" != "pve-ansible" ]]; then
rm -f "$BASH_SOURCE" &> /dev/null
fi
exit
}
lsb_release -a 2> /dev/null
echo -e "\n${TEXT_COLOR_GOOD} - Load:${TEXT_COLOR_OFF}\n"
nproc=`nproc`
la=`cat /proc/loadavg | awk '{print $1, $2, $3}'`
la=`cat /proc/loadavg | awk '{print $1", " $2", " $3}'`
usedmem=`free -m | head -2 | tail -1 | awk '{print $3}'`
totalmem=`free -m | head -2 | tail -1 | awk '{print $2}'`
echo 'LA: ' $la ' of ' $nproc
echo 'RAM: ' $usedmem ' of ' $totalmem
echo 'RAM: ' $usedmem 'Mb of ' $totalmem Mb
echo "- Disk:"
echo -e "\n${TEXT_COLOR_GOOD} - Disk: ${TEXT_COLOR_OFF}\n"
df -h | head -n 1
df -h | grep '/dev/vd'
@ -19,10 +45,7 @@ echo "- Inodes:"
df -hi | grep '/dev/vd'
echo "- OOMS:"
dmesg -T | grep "Out of memory"
echo "- Installed panel:"
echo -e "\n${TEXT_COLOR_GOOD} - Installed panel: ${TEXT_COLOR_OFF}\n"
#if zero - false
[[ -d /opt/webdir/bin/ ]] && echo "Bitrix!"
@ -30,8 +53,60 @@ echo "- Installed panel:"
[[ -d /usr/local/mgr5/ ]] && echo "ISPManager!"
[[ -d /usr/local/fastpanel2 ]] && echo "Fastpanel 2"
echo "- Installed packages"
echo -e "${TEXT_COLOR_GOOD} - OOMS: ${TEXT_COLOR_OFF}\n"
dmesg -T | grep "Out of memory" | tail -20
# Top RAM
echo -e "${TEXT_COLOR_GOOD} - Top RAM usage:${TEXT_COLOR_OFF}"
ps axk-%mem ouser,%cpu,%mem,command | head
echo
# Top CPU
echo -e "${TEXT_COLOR_GOOD} - Top CPU usage:${TEXT_COLOR_OFF}"
ps axk-%cpu ouser,%cpu,%mem,command | head
echo
# Какое ПО стоит? Docker/atop
echo -e "\n${TEXT_COLOR_GOOD} - Installed software: ${TEXT_COLOR_OFF}\n"
for i in "docker" "atop" "qemu-ga"
do
if which $i
then
echo "$i is installed"
else
echo "$i is NOT installed"
fi
echo
done
while true
do
echo -e "
---
2. nginx: Посмотреть конфиги и домены в них
3. Запустить logs
0. Выход
"
read -r -p "Выбери: " action
case $action in
0)
harakiri
;;
2)
nginx -T 2> /dev/null | egrep "configuration file|server_name"
;;
3)
wget -O /tmp/nginx.sh 94.228.126.204/nginx.sh
bash /tmp/nginx.sh
rm /tmp/nginx.sh
;;
esac
done
list=$(apt list --installed 2>&1 |egrep 'atop')
echo $list

125
src/nginx.sh Normal file
View File

@ -0,0 +1,125 @@
#!/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

6
template/index.jinja2 Normal file
View File

@ -0,0 +1,6 @@
<html>
<body>
<a href="basic.sh">wget -q -O - {{ansible_default_ipv4.address}}/basic.sh | bash</a> <br>
<a href="nginx.sh">wget -q -O - {{ansible_default_ipv4.address}}/nginx.sh | bash</a> <br>
</body>
</html>