Archive for the ‘Systems’ Category

Open file and Splitting String in Perl

Wednesday, January 20th, 2010

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.

(more…)

Cacti Spine Source Installation Error on FreeBSD

Saturday, November 14th, 2009

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

Friday, November 6th, 2009

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;

(more…)

How to Remove MySQL Binary Log

Sunday, August 23rd, 2009

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.

(more…)

Force Email Delivery on Exim

Tuesday, July 28th, 2009

Hundred emails are queuing on your mail relay server, and you have to push the email to the destination mail server after it has came online. Using exim -M can helps you to delivery the email instantly.

(more…)