TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Linux commands, scripts, examples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

Linux. Server, system monitoring script: .bashrc

 


.bashrc additional script to monitor system:
#############################################
#                                           #
# Begin: Main commands                      #
#                                           #
#############################################

clear

echo ----- NETSTAT -----
netstat -ntp | grep :80 | grep -v TIME_WAIT | grep -v FIN_WAIT2 | more
echo
echo ----- HTTP processess -----
ps -ef | grep httpd |  wc -l
echo
echo ----- UPTIME -----
uptime
echo
echo ----- FREE -----
free -m
echo
echo ----- VMSTAT -----
vmstat
echo

#!/bin/bash

#############################################
#                                           #
# Folders and disks: count and amount :)    #
#                                           #
#############################################


clear

echo -e "\n\n FREE \n"
df -h
sleep 1

echo -e "\n\n INODES \n"
df -i
sleep 4

echo -e "\n\n CACHE files\n"

echo -e "\n\t SITE 1\n"

folder=/var_www/pro_com/cache/*

for file in $folder ; do


    if [ -d $file ]
    then

        find=` find  $file -type f -print| wc -l `

        echo $file $find

        sleep 1

    fi


done

echo -e "\n\t Site 2  \n"

folder=/var_www/en/cache/*

for file in $folder ; do


    if [ -d $file ]
    then

        find=` find  $file -type f -print| wc -l `

        echo $file $find

        sleep 1

    fi


done

exit 0

You can add auth.log monitoring:

folder="/_logs/"
date >> ${folder}ip_illegal.log
date > ${folder}ip_failed.log


grep -E "invalid user" /var/log/auth*log* | awk '{ print $11,   $13 , $15 }' | uniq >> ${folder}ip_invalid_user.log

grep Failed /var/log/auth*log* | awk '{ print $0 }'  | uniq >> ${folder}ip_failed.log

grep refused /var/log/auth*log* | awk '{ print $1 $2 $10 }' | uniq > ${folder}ip_refused.log

grep su /var/log/auth*log* | awk  '$5 ~/su/{ print $0 }'   > ${folder}ip_su.log

grep -v CRON /var/log/auth*.log | grep -v Failed  > ${folder}ip_logins.log

grep Illegal  /var/log/auth*.log >${folder}ip_illegal_logins.log

more $folder/*

 
Previous articlePage topNext article  ALL TOPICS


Guest:
May add filetered ps, iotop, uptime


2013-06-07 11:13:21

 Use username: Guest, Anonymous, Programmer






QUOTES:
Success breeds conservatism, and that means a love affair with the status quo and an aversion to change.
Frank Popoff
Wisdom doesn't necessarily come with age. Sometimes age just shows up all by itself.
Woodrow T. Wilson
She wanted to stay together. She hoped he was happy in his new endeavors, and she didn't want to live without him.
Tom Cooper