Archive for the ‘Coding’ Category

How to obtain InnoDB status from Mysql Server 5.x

|

 

Many users use innodb engine for their databases. It’s good to monitor status of mysql and one part of it is monitor status of InnoDb.

Simple way to monitor innodb is just use SHOW command

SHOW ENGINE INNODB STATUS;

If you have big system on very high load, it’s possible that long DEAD LOCK brake the output.

Mysql show only part of status and then cut other informations off. It’s not bad if you have realy big dead lock but it’s not good for your monitoring.

Another way to monitor status of INNODB is using files in /proc filesystem. Here is small script that read informations from this file.

You can modify this little for your system, add cut off dead lock part for examle.

 

#!/bin/bash

export LC_ALL=POSIX

## Check for MYSQL pid
MYSQLPID=`ps -U mysqld | grep mysqld | awk '{print $1}'`

cd /proc/$MYSQLPID/fd/

## Let find the file with innodb status
for i in `ls -l| grep delete| grep tmp| awk '{print $9}'` ; do
       grep "INNODB MONITOR OUTPUT" ./$i 2>&1 > /dev/null

       if [ $? == 0 ] ; then
            file="$i"
       fi
done

## Print innodb status

cat $file

 

Web shell

|

Small funny web shell based on cgi (perl).

Screenshot

Web shell

Web shell

(more…)

Bruteforce blocker for OpenSSH

|

My friend find little script in perl called bruteforce blocker. It’s daemon which read logs and find login failed records. This script count them and after defined failed logins adds rule to iptables to block IP address.

(more…)

OpenSSH hide host and version patch

|

This is small patch for openssh. It hides version information and hostname of remote clients. Hostname is rewrited to static string you can see via finger, who, w, last, lastb etc.

(more…)