Adding a XFS filesystem to CentOS 5

Howto use enterprise Linux ‘extras’ to mount a XFS filesystem on a CentOS v5.2 VM Install RPM’s Note: Due to this bug (3205), install binutils to overcome the error “xargs: nm: No such file or directory” while installing kmod-xfs-xen. # yum install binutils # yum install xfsprogs yum-kmod kmod-xfs-xen # mkfs.xfs -f /dev/sda1 Check A chunk of…

Search entire filesystem for text in Linux

To search for text through the entire filesystem from the current path down in Linux use the following : find / -type f -print0 | xargs -0  grep -l  "string to search" 2>/dev/null

Script to list all the MAC addresses on the system

Listing the mac addresses of nic cards excluding null or loopback MACs i.e. 00:00:00:00:00:00 grep -H . /sys/class/net/*/address | awk ‘{split($0,array,”address:”);print array[2]}’ | grep -v ’00:00:00:00:00:00′      

Force fsck on next boot

Since live systems are near to impossible to fsck when running (unless you can pull one side of the mirror then clone it to the other (very messy). Become Root sudo su – or su – As root create file in root folder a file named forcefsck touch /forcefsck Restart the system. shutdown -r now

Using .htaccess to redirect a page with permanently moved 301

Though there are many ways to redirect using the HTTP 301 status code. (make sure the AllowOverride is set to all on the apache config) The .htaccess must be as follows: Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^orig.domain.com [nc] rewriterule ^(.*)$ http://new.domain.com/ $1 [r=301,nc] Replace the orig.domain.com and new.domain.com with the ones needed for your…

Nagios fail to run ifstatus

/usr/local/nagios/libexec/check_ifstatus -H localhost &nbsp Can’t locate Net/SNMP.pm in @INC (@INC contains: /usr/local/nagios/libexec /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at ./check_ifstatus line 38. BEGIN failed–compilation aborted at ./check_ifstatus line 38.   Solution: yum install perl-Net-SNMP

Nagios configuration debugging

After testing a nagios configuration update ( including a new service or renaming some host etc..) before committing the changes and reloading / restarting the nagios service a good test is the following: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

iptraf boxes do not show up well

On one of my servers running CentOS 6 I had iptraf not displaying the boxes in dialogues correctly.  It’s usually fixed by updating the session configuration on putty to translate to utf-8 but in this case that did not work. While the system is a clone from another machine where it works well (puppet confirms) all…

Quick script to get path to latest nagios version

If you need to automate the retrieval of the latest Nagios version path to download this is how I do it. Nothing fancy and it breaks if they change the sourceforge site but we can fix when that happens 🙂   curl -v http://www.nagios.org/download/core/thanks/ 2>&1 | grep tar\.gz | cut -d \” -f 2 |…

Wireshark: cutting the crap

DisplayFilters Wireshark uses display filters for general packet filtering while viewing and for its ColoringRules. The basics and the syntax of the display filters are described in the User’s Guide. The master list of display filter protocol fields can be found in the display filter reference. If you need a display filter for a specific protocol, have a look for…