Author Archives: CharlyBr

Enhance your munin load graph

This is the default output of the munin load plugin. I’ve patched it to add a permanent blue line indicating the number of cpu of the server. The resulted graph looks like this : You can download the patched plugin here. It is tested with Linux and FreeBSD.

Optimizing Servers and Processes for Speed with ionice, nice, ulimit

Just found this very good article about optimizing servers.

Quickly check hosts with ping

I needed a script for a quick health check of a bunch of servers. This is how I did it using the ping command: for((i=1;i<42;i++)); do ping -c 1 -W 3 host${i}.domain.com &> /dev/null if [ $? -ne 0 ] ; then echo “host${i} is down” else echo “host${i} is up” fi done You can [...]

Set Terminal tab title in Mac OS X

I wrote previously a how-to to set your iTerm tab title. I finally found a tool to do the same thing with the default Mac OS X Terminal. Check it out here, it works perfectly for me!  link is dead. On my Mac OS X 10.6.6 and bash (3.2.48(1)-release), you can set your tab title [...]

Set the number of reserved filesystem blocks of a disk

The default value of “Reserved block count” takes 5% of usable disk. On a large fs like 813G, it represents about 40G. These blocks are reserved to the super user to recover from situations where user processes fill up filesystems. It is absolutely safe to reduce this space to one hundred or so MB. check [...]

Finding the total size of a set of files with awk

If you need to sum the total size of files in a directory or matching a pattern, an easy solution is to use awk. I needed to calculate this total for a set of javascript files, I used this command line: $ find App/ -name ‘*.js’ -exec ls -l \{\} \; | awk ‘{sum+=$5} END [...]

Permanent redirect with nginx

server { server_name domain.com; rewrite ^(.*)$ http://www.domain.com$1 permanent; }

Memory usage by group of processes

While monitoring a http/php server, I needed to do some statistics about php-cgi memory usage. Playing with memory_limit in PHP, we wanted to know the average memory usage per php-cgi process. This is easily calculated with our best friend awk. First, get the number of php running processes: # ps aux | grep php-cgi | [...]

permanently load enable HTTP Accept Filter FreeBSD kernel module (accf_http)

While reading articles about optimization, I read about the accf_http module. The man page of the module is here, where you can read: The utility of accf_http is such that a server will not have to context switch several times before performing the initial parsing of the request. To load this module, use the following [...]

Munin and Use of uninitializer value in eval

On some of freshly installed servers (Debian Etch), I encountered these error messages in /var/log/munin/munin-node.log: Use of uninitialized value in eval {block} exit at /usr/sbin/munin-node line 456, <CHILD> line 8. What a great error message After digging into Google results, I found it was just a problem with host_name variable in the configuration. Default value [...]