Tuesday, April 22, 2008

Monitoring network using scripts

I've been working on some script for this few days to monitor the network connectivity for one of my servers. Technically the server have 2 network interfaces connected to network which is "eth0" & "eth2".

Each of this interface will have a different vlan and pointing to a different gateway:
eth0 -> 192.168.10.254
eth2 -> 192.168.11.254

The main interface used will be "eth0" and there are services which will point through this vlan, in case that the interface or the switch connected to this interface fail, it will need to switch to the other interface which is "eth2".

I've created the script as below:

#!/bin/bash
# Script for system monitoring with ping command
# Editor : Mohammad Al Ghazali Ismail

# Gateway
GW1="192.168.10.254"
GW2="192.168.11.254"

# Email
EMAILADD="someone@somedomain.com"

# Mail Subject
SUBJECT="Network Server Fail"

# Number of ping request
COUNT=5

count=$(ping -c $COUNT $GW1 | grep 'received' | awk -F ',' '{print $2}' | awk '{print $1}')
# If 100% failed
if [ $count -eq 0 ]; then
# 100% failed, check for GW2
count=$(ping -c $COUNT $GW2 | grep 'received' | awk -F ',' '{print $2}' | awk '{print $1}')
if [ $count -eq 0 ]; then
# send notification to user
echo "Unable to resolve ping from gateway $GW1 and $GW2 on $(date)" | mail -s "$SUBJECT" $EMAILADD
else
# start the service on 2nd vlan
start servicename on eth2
fi
else
# check the service on 2nd vlan
check servicename on eth2
if servicename is up
stop servicename on eth2
start servicename on eth0
fi
fi

I save the script on some directory and added it into the crontab which will execute it every 2 minutes:

# crontab -e
*/2 * * * * sh /directory/script.sh

Notes : The italic word need to be replace with the right method of checking, starting and stopping the services.

Google Snake Game

Here’s a party game which needs nothing but a working internet connection (say, a notebook or cell phone), and Google.com’s web search. The goal is to create the longest phrase that Google can find by alternately adding one word to the end of the other player’s search phrase.

Say, the first person starts with “Feelings”. Now the second person adds a word, “are”, so we get “Feelings are”... (Note the use of quotation marks in the search query.) Now every time a word is added, the phrase is searched for in Google, and the resulting page count is announced to the group. The one person who creates a sentence with zero results in Google loses and has
to do something silly (or if you want to play with points, he loses a point, and the last person who created a sentence with results in Google will win a point).

To prevent cheating, the one whose turn is next is not allowed to look at any search result snippet. Let’s take our sample, and see what we get:
  • Peter: “Feelings” (53,200,000 results in Google)
  • Mary: “Feelings are” (2,100,000 results)
  • Jake: “Feelings are nothing” (1,090 results)
  • Susan: “Feelings are nothing and” (19 results)
  • Peter: “Feelings are nothing and we” (0 results)
  • Susan gets 1 point, and Peter gets minus 1 points (or has to do something silly).
If you create too obscure a sentence there won’t be any results and you will lose, but if your sentence gets too many results, your opponent will also be able to create a sentence with results. The basic strategy is to try to create sentences so silly that there are only a few results, but not so silly there are no results…

Have fun!!

Monday, April 21, 2008

Majlis Perkahwinan Effy dan Rosli


Mempelai dua sejoli
Album perkahwinan


And for those yang selalu tanya2 dengan aku, dan masih tertanya2 siapa sebenarnya pasangan aku,jeng jeng jeng...

Thursday, April 17, 2008

Memory of bumi kenyalang....


Aku sampai kat bumi kenyalang ni dalam jam 11.30 a.m. Terus aku pegi mencari hotel penginapan, as suggested by my dear, aku pun pegi la hotel supreme. That evening, hujan lebat turun mencurah2, dah la lapau, hujan plak tu, nak kuar mkn pun tak bleh...huhuh....
Around 4.00 p.m hujan pun reda, aku pun start la jalan2 kat sekitar bandar kuching ni, dan aku dapat snap gambar ni, kuching besau bersama pintu gerbang masuk ke jalan yang seakan-akan pekan koboi, aku pun tak berapa ingat nama jalan ni...
Since ada tourist yang tgh bergambar kat situ, aku pun minta la tolong dia snap kan gbr aku gak, kuching tu lagi friendly dari aku, siap lambai2 lagi posing depan camera,hehehehe....
Punya la aku pusing2 cari makan, at last,Q suggest suruh aku makan kat TopSpot. Dia kata try sup gamat, guess what it look like? you can see it as above,heheheh, and how do it tast...well great!!

Outerier design yang aku sempat snap kat depan TopSpot...artistic isn'it.....
Here's are a few scenery yg aku sempat capture lepas aku da siap keje. Aku minta driver teksi tu bwk aku pusing2 around kuching....


Tuesday, April 15, 2008

My last state...


6.15 - As usual, wake up as usual, performing my pray as usual. Getting ready to visit my last state that I've never visit b4. SARAWAK.
7.15 - On my way to LCCT, I seldom take a cab here from Putrajaya, but it's better to be early than late. It cost me around RM56 from Putrajaya to LCCT...sheeeeesh...
8-15 - Check in my luggage.
8 - 30 - Here I am, having breakfast at the Coffe Bean.
9.15 - In the flight.....Sarawak...here I come....weeeeee...

Friday, April 11, 2008

Egogoogling

Have you ever searched for your own name on Google, curious what the world has to say about you? Almost everyone of us did, one time or another. In fact, you should – maybe others search for you all the same, and you want to know what they will find.

The act of searching for yourself is also known as “egogoogling.” Here’s a variant of it which can be a fun game. Enter your first name followed by the word “is” into Google, and put the search in quotes. For example, if your name is Susan, the search would look like this:
“susan is” Now in the search result snippets, you will learn a lot of things about
you that you didn’t even know!

For the name “Susan,” we get the following:
  • Susan is an amazing person to work with!
  • Susan is an ethical woman and is refusing to cooperate
  • Susan is a very attractive young lady (with a boyfriend) who for some reason is always late.
  • Susan is a top Florida residential real estate agent.
  • Susan is a top producer specializing in the ski resort town of Breckenridge, as well as the surrounding area.
Not only can you apply this approach to find out more about yourself (or just have a good laugh, actually, as the results are likely to be about another person), you can also use this to find out about celebrities. To do so, enter the full celebrity name followed by the word “is” into

Google, and put it in quotes again:
“arnold schwarzenegger is”

For action movie star Arnie, we get these results:
  • Arnold Schwarzenegger is a very talented man who would make an excellent governor.
  • Arnold Schwarzenegger is falling into a similar spiral.
  • Arnold Schwarzenegger is looking out for voters’ best interests.
  • Arnold Schwarzenegger is a man more familiar with the red carpets of a movie premiere than a white collar business seminar.
  • Arnold Schwarzenegger is terrifying as the “killer cyborg” who “looks like Death rendered in steel.”
  • Arnold Schwarzenegger is The Terminator (T-800).
  • Arnold Schwarzenegger is quickly discovering that life in politics doesn’t always produce the happy endings so common in many of his Hollywood blockbusters.
Note that you can use “stars in,” “was born in” and similar glue words instead of “is” to find out almost anything about a celebrity. You can even expand the idea to include things, not people… try searching for “Nikon cameras are” and similar queries.

Thursday, April 10, 2008

Jangan bilang tidak - Rafi Ahmad & Ayushita

Ku pernah punya cinta namun kini ku sedang suka kamu
Cintaku dulu tlah kubuang jauh kini ku ingin kamu

Ku pernah menyendiri di sini ku akan terasa sepi
Walaupun bibir penuh gelak tawa namun hatiku sepi

Jangan bilang tidak bila kita belum mencoba
Siapa yang tahu akan sama hatimu dan juga hatiku
Banyak yang bercinta bertahun-tahun putus juga
Kuharapkan dengan dirimu walaupun singkat pendekatan
Cinta kita kan abadi

Ku pernah punya cinta namun kini ku sedang suka kamu
Cintaku dulu tlah kubuang jauh kini ku ingin kamu

Jangan bilang tidak bila kita belum mencoba
Siapa yang tahu akan sama hatimu dan juga hatiku
Banyak yang bercinta bertahun-tahun putus juga
Kuharapkan dengan dirimu walaupun singkat pendekatan

Jangan bilang tidak waktu dicium aku bingung
Namun dada ini bergetar
Makanya sungguh aku mohon
Jangan bilang tidak

My car.....again....




Accident do happen, tapi unexpectedly aku disondol dlm keadaan aku membawa dengan berhati2, adussssss. Bekerja kat penjara ni, da macam2 yg aku alami, betul2 jadi tempat kenangan untuk aku. Nasib la aku tak kene bayar...huhuhuhhu...


Friday, April 4, 2008

Another beautiful scenery


Late evening 2 days ago, aku lepak dengan chek kat IPPM, sementara tunggu nak migrate server malam tu aku berjaya capture la scenary remang2 senja dengan pelangi yang aku rasa rare sekali boleh dapat pemandangan ni. Memang cantik dan memang aku bersyukur padaNya sebab aku antara insan yang bertuah dapat melihat pemandangan yg Dia ciptakan.

And on the next morning waktu aku nak pegi IPPM amik charger, aku berjaya capture 1 lagi scenery yang aku kira tak kurang hebatnya...alhamdulillah..