Open file and Splitting String in Perl

What I gonna do is to read a bunch of data from a file, and perform some data processing from the string.

  • split() is the Perl function which I will use for filtering the data.
  • open for reading a file into array.

I took MRTG’s data log to do some data processing. On the first column of MRTG log file is Unix timestamp, I would like to print the unix Timestamp to human readable date and time, the other columns are traffic in and out in bytes, which I want to find out which traffic is more than certain values.

Read the rest of this entry »

How to Redirect Wordpress RSS Feed to Feedburner

If you would like to find out your RSS subscriber’s statistic, it’s good to redirect all your RSS feed to Feedburner. One of the reason I like Feedburner’s RSS page is it provides reader with convenience short cut button to add into Google Reader, Yahoo Read, Newsgater and many more. Below is the comparison of Firefox Feed page and Feedburner Feed Page.

Feedburner Feed Page

Firefox Feed Page

Read the rest of this entry »

Cacti Spine Source Installation Error on FreeBSD

Just noticed FreeBSD’s port still using old version of spine, decided to install from source and seem like source install doesn’t work well with FreeBSD. It returns error due to libtool version different from the source file. First when run –configure command it returns config error;


./configure
configure: error: cannot run /bin/sh config/config.sub

List the file on config folder and found it’s symlink to invalid file;


ls -al config/*
total 56
drwxr-xr-x  2 1000  100    512 Jun 29 10:03 .
drwxr-xr-x  4 1000  100   1024 Nov 14 14:04 ..
lrwxrwxrwx  1 1000  100     31 Jun 29 10:03 config.guess -> /usr/share/libtool/config.guess
-rw-r--r--  1 1000  100   5969 Jun 29 10:03 config.h
-rw-r--r--  1 1000  100   5561 Jun 29 10:03 config.h.in
-rw-r--r--  1 1000  100   5550 Jun 29 10:03 config.h.in~
lrwxrwxrwx  1 1000  100     29 Jun 29 10:03 config.sub -> /usr/share/libtool/config.sub
-rwxr-xr-x  1 1000  100  12517 Jun 29 10:03 depcomp
-rwxr-xr-x  1 1000  100   5561 Jun 29 10:03 install-sh
lrwxrwxrwx  1 1000  100     28 Jun 29 10:03 ltmain.sh -> /usr/share/libtool/ltmain.sh
-rwxr-xr-x  1 1000  100  10280 Jun 29 10:03 missing
-rw-r--r--  1 1000  100     30 Jun 29 10:03 stamp-h1

config.guess, config.sub and ltmain.sh is symlink to the wrong directory, remove the files and symlink to correct path


shell> cd config
shell> rm -rf config.guess
shell> rm -rf config.sub
shell> ltmain.sh
shell> ln -s /usr/local/share/libtool/config/config.sub .
shell> ln -s /usr/local/share/libtool/config/config.guess .
shell> ln -s /usr/local/share/libtool/config/ltmain.sh .

Seem like everything is fine, let run ./configure and I have another problema and I do make command


shell> make
CDPATH: not found
func_opt_split: not found
libtool: Version mismatch error.  This is libtool 2.2.6, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6
libtool: and run autoconf again.
*** Error code 63

Stop in /root/paul-work/cacti-spine-0.8.7e.

To fix aclocal problem


aclocal
libtoolize --force
autoconf
autoheader
automake
./configure

Run configure and make again. Should be no problem by now.

Retrieve CPU and Memory Information on FreeBSD

Server running slow and how to check CPU/Processor and RAM/Memory info on FreeBSD? There are couple of ways to retrieve the information, by dmesg or sysctl.

Check CPU/Processor Speed on FreeBSD

Get CPU info by sysctl;

Read the rest of this entry »

How to Remove MySQL Binary Log

By default, MySQL 5.0 and above enables MySQL Binary Log. Keeping MySQL Binary Log might take up a lot of disk space for long run. Older MySQL Binary log can be removed in order to keep your hard disk space free.

Read the rest of this entry »