Monday, January 11, 2010

Monitor Memcached status

It is quite a important task to manage and monitor the memcache caching system. There are quite a lot of options to carry out this operation.

1. Using Telnet Command Line interface

List of supported commands are available at

telnet localhost 11211

List of keys used

stats items

STAT items:5:number 2
STAT items:5:age 47
STAT items:5:evicted 0
STAT items:5:evicted_nonzero 0
STAT items:5:evicted_time 0
STAT items:5:outofmemory 0
STAT items:5:tailrepairs 0

2. Using memcached-tool

The memcached tool is available in the source directory .



/usr/src/memcached-1.4.4/scripts/memcached-tool stats

Show slab information

/usr/src/memcached-1.4.4/scripts/memcached-tool display

Show keys and values

/usr/src/memcached-1.4.4/scripts/memcached-tool dump

3. Using the damemtop

A flexible 'top' like utility for viewing memcached clusters. You can use it to manage a interactive cluster status.

The utility is available in the source directory. /usr/src/memcached-1.4.4/scripts/damemtop

It require you to install the following perl modules

cpan AnyEvent Term::ReadKey YAML

Now you need the /etc/damemtop.yaml file with the following contents.

delay: 3
mode: t
sort_column: "hostname"
sort_order: "asc"
- hostname
- all_version
- all_fill_rate
- hit_rate
- evictions
- bytes_written
- "2:get_hits"
- 127.0.01:11211

In a distributed environment you can add all the servers in the cluster to the file and issue the following command.


That would give you a ideal monitoring setup..

Sunday, January 10, 2010

Install Memcached caching sytem in centos from source

memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

It is mainly used in MYSQL + PHP or MYSQL + JAVA applications which are quite database intensive.


yum -y install libevent libevent-devel

Download Source

tar zxf memcached-1.4.4.tar.gz
cd memcached-1.4.4
./configure && make && make install

Test the installation

memcached -m 256 -u nobody -vv
slab class 1: chunk size 80 perslab 13107
slab class 2: chunk size 104 perslab 10082
<29 send buffer was 110592, now 268435456
<29 server listening (udp)
<29 server listening (udp)

Start the Daemon

memcached -d -m 256 -u nobody -p 11211 -l

The above command will start the memcached daemon in port 11211

Ensure that it is working.

netstat -plan|grep 11211
tcp 0 0* LISTEN 7049/memcached

Thats it.. Enjoy the power of caching system..

Friday, January 8, 2010

Check Ubuntu 8.04 server security using OpenVAS

Install openvas server from source in ubunutu 8.04

apt-get install build-essential libgtk2.0-dev libglib2.0-dev libssl-dev htmldoc libgnutls-dev libpcap0.8-dev bison libgpgme11-dev libsmbclient-dev snmp pnscan

add the following line to /etc/apt/sources.list

deb sid main

Install the server

apt-get install openvas-server openvas-server-dev openvas-plugins-dfsg openvas-plugins-base libopenvas2 libopenvas2-dev libopenvasnasl2 libopenvasnasl2-dev

Add your user


Update the feeds


start the server

/etc/init.d/openvas-server start

Install the client

It would ask you to upgrade php etc and hence I compiled the agent from source. The trunk is incompatible with the openvas-server provided by debian repository.

svn co openvas-client

cd openvas-client

./configure && make && make install

Running the agent in batch mode:

You can run the client to produce beautiful html with graphs using the following command line.

create a file named target with the host you want to check

cat >target

OpenVAS-Client -q localhost 9390 ovasuser mypasswd target localhost-result -T html_graph -x

The run would take around 15 minutes and you will get the results in the localhost-result directory. View the HTML files using browser.