mikbilltuner
Наброски
https://adobkin.com/2011/07/06/701/
mcedit mikbilltuner.sh
chmod +x mikbilltuner.sh
***************************************************
#!/bin/sh
echo ""
os=$(uname -s)
pach=/var/www/mikbill/admin/
dist='Distr- unknown'
case "${os}" in
'Linux')
if [ -r '/etc/debian_version' ]; then
if [ -r '/etc/dpkg/origins/ubuntu' ]; then
dist='Ubuntu'
else
dist='Debian'
fi
dist=$dist" "$(cat /etc/debian_version)
fi
if [ -r '/etc/redhat-release' ]; then
dist=$(cat /etc/redhat-release)
fi
;;
'FreeBSD')
dist_name=$os" "$(uname -r)
pach=/usr/local/www/mikbill/admin/
;;
esac
echo -e "\e[35m$dist\e[0m"
echo "$(uptime)"
#Services
check_service ()
{
if [[ $(netstat -nl|grep $2)>'0' ]]
then
echo "port $2 is used ($1)"
else
echo -e "port $2 \e[31m Not used ($1)\e[0m"
fi
***************************************************
Заметки из уделенного
sed -n 5,6p $pach'sys/update/sqlupd/deploy/build.properties'
php -v| head -n1
uptime | grep -o 'load average.*'
uptime | grep -o 'load average.*' | cut -c 15-18
MAX_LOAD=20.0
LOAD=`uptime | grep -o 'load average.*' | grep -v grep | cut -c 15-18`
if [ $LOAD \> $MAX_LOAD ]; then
echo $LOAD | mail -s 'High load [SERVERNAME]' admins@example.com
fi
cat /proc/loadavg | cut -c6-9
https://adobkin.com/2011/07/06/701/
mcedit mikbilltuner.sh
chmod +x mikbilltuner.sh
***************************************************
#!/bin/sh
echo ""
os=$(uname -s)
pach=/var/www/mikbill/admin/
dist='Distr- unknown'
case "${os}" in
'Linux')
if [ -r '/etc/debian_version' ]; then
if [ -r '/etc/dpkg/origins/ubuntu' ]; then
dist='Ubuntu'
else
dist='Debian'
fi
dist=$dist" "$(cat /etc/debian_version)
fi
if [ -r '/etc/redhat-release' ]; then
dist=$(cat /etc/redhat-release)
fi
;;
'FreeBSD')
dist_name=$os" "$(uname -r)
pach=/usr/local/www/mikbill/admin/
;;
esac
echo -e "\e[35m$dist\e[0m"
echo "$(uptime)"
#Services
check_service ()
{
if [[ $(netstat -nl|grep $2)>'0' ]]
then
echo "port $2 is used ($1)"
else
echo -e "port $2 \e[31m Not used ($1)\e[0m"
fi
}
check_service "Mikbill" "2007"
check_service "Radius" "1812"
check_service "MySQL" "3306"
check_service "Dhcp" "67"
#Info
echo "mikbill_current "$(cat $pach/sys/update/mikbill_current)
if [ -r $pach'/app/etc/client.key' ] && [ -r $pach'/app/etc/serv.crt' ]; then
echo "License"
else
echo "Starter"
fi
#Servers update
address ()
{
ping -c 1 -i3 $1>/dev/null
if [ $? -eq 0 ]; then
echo "host $1 OK"
else echo -e "host $1 \e[31m Not available \e[0m"
fi
}
address "cert1.celteh.com"; address "cert2.celteh.com"; address "cert3.celteh.com"
#Soft
#php -r \@phpinfo\(\)\; | grep 'PHP Version' -m 1
if [ -r /usr/local/etc/raddb/sites-enabled/dhcp ]; then
echo "/usr/local/etc/raddb/sites-enabled/dhcp -ОК (Mikbill DHCP)"
***************************************************
#Login pass
#echo "MySQL" $(sed -n 5,5p $pach'app/etc/config.xml') $(sed -n 6,6p $pach'app/etc/config.xml')
#Filesystem
Заметки из уделенного
sed -n 5,6p $pach'sys/update/sqlupd/deploy/build.properties'
php -v| head -n1
uptime | grep -o 'load average.*'
uptime | grep -o 'load average.*' | cut -c 15-18
MAX_LOAD=20.0
LOAD=`uptime | grep -o 'load average.*' | grep -v grep | cut -c 15-18`
if [ $LOAD \> $MAX_LOAD ]; then
echo $LOAD | mail -s 'High load [SERVERNAME]' admins@example.com
fi
cat /proc/loadavg | cut -c6-9
Комментарии
Отправить комментарий