Compare commits

..

28 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
6 changed files with 225 additions and 92 deletions

View File

@@ -1,23 +1,6 @@
--- ---
kind: pipeline kind: pipeline
type: exec type: exec
name: check on test
trigger:
event:
- push
- pull_request
steps:
- name: Check playbook
commands:
- ansible-playbook -C playbook.yml
node:
target: local
---
kind: pipeline
type: exec
name: deploy to prod name: deploy to prod
steps: steps:
@@ -31,57 +14,3 @@ steps:
node: node:
target: shell-scripts target: shell-scripts
trigger:
event:
- promote
target:
- production
---
kind: pipeline
type: exec
name: deploy to local test
steps:
- name: Check playbook
commands:
- ansible-playbook -C playbook.yml
- name: Run playbook
commands:
- ansible-playbook playbook.yml
node:
target: local
trigger:
event:
- promote
target:
- local
---
kind: pipeline
type: exec
name: deploy to public test
steps:
- name: Check playbook
commands:
- ansible-playbook -C playbook.yml
- name: Run playbook
commands:
- ansible-playbook playbook.yml
node:
target: shell-testing
trigger:
event:
- promote
target:
- testing

View File

@@ -6,8 +6,7 @@
become: yes become: yes
apt: apt:
name: nginx-light name: nginx-light
update_cache: yes state: present
state: latest
- name: Create dir - name: Create dir
file: file:
path: /var/www path: /var/www
@@ -21,6 +20,14 @@
group: www-data group: www-data
with_fileglob: with_fileglob:
- src/* - 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 - name: Copy config file
become: yes become: yes
copy: copy:

View File

@@ -1,16 +1,42 @@
#!/bin/bash #!/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` 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}'` usedmem=`free -m | head -2 | tail -1 | awk '{print $3}'`
totalmem=`free -m | head -2 | tail -1 | awk '{print $2}'` totalmem=`free -m | head -2 | tail -1 | awk '{print $2}'`
echo 'LA: ' $la ' of ' $nproc 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 | head -n 1
df -h | grep '/dev/vd' df -h | grep '/dev/vd'
@@ -19,10 +45,7 @@ echo "- Inodes:"
df -hi | grep '/dev/vd' df -hi | grep '/dev/vd'
echo "- OOMS:" echo -e "\n${TEXT_COLOR_GOOD} - Installed panel: ${TEXT_COLOR_OFF}\n"
dmesg -T | grep "Out of memory"
echo "- Installed panel:"
#if zero - false #if zero - false
[[ -d /opt/webdir/bin/ ]] && echo "Bitrix!" [[ -d /opt/webdir/bin/ ]] && echo "Bitrix!"
@@ -30,8 +53,60 @@ echo "- Installed panel:"
[[ -d /usr/local/mgr5/ ]] && echo "ISPManager!" [[ -d /usr/local/mgr5/ ]] && echo "ISPManager!"
[[ -d /usr/local/fastpanel2 ]] && echo "Fastpanel 2" [[ -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

View File

@@ -1,6 +0,0 @@
<html>
<body>
<a href="basic.sh">wget -q -O - otp-bash.tw1.ru/basic.sh | bash</a>
<a href="nginx.sh">wget -q -O - otp-bash.tw1.ru/nginx.sh | bash</a>
</body>
</html>

View File

@@ -1,3 +1,125 @@
#!/bin/bash #!/bin/bash
echo "- Sort by IP"
cat /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -hr | head -n 30 # 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>