Friday, July 4, 2008
Home at last...
Yes, my coupe had a family with a very little 5-6 month old brat and his big sister who had to be the brattiest fucking brat ever (not to mention the fact that the neighbouring coupes had a brat each). The stupid piece of filth could not sit still for no less than 2 seconds. And if you think i'm exaggerating, kindly ask her parents who told me that she couldnt sit still at all. tiI can understand that the little brat couldn't do much but cry, because that's the only thing little brats can do (right?), but that darn swine of a sister of his kept crying for attention while her unfortunate parents tried to attend to the routine diaper changes and what not. I'm sure they must have sinned like crazy to get a kid like that. Her folks tried 'asking' her to keep quiet, but in vain. If I were the parent, I wouldn't resort to words to get the job done. I'd be quick to toss her out of the train, preferrably off a bridge so that the chances of survival are grim and that there is no possibility of some unfortunate passerby having to find her and take her in. For most of the trip, I confined myself to my upper berth and thought of ways to get rid of the brat. I even thought of ways to get rid of the little brat just in case. You can be sure that he'll grow up to be just like his sister. I'd share those thoughts with you but it might end up being too graphic and is hence not appropriate for any age group at all. Luckily, there was a Malayali guy and his mom on their way to Calicut on the side berths. The guy's name was Nikhil and he'd just complete his twelth grade from KV Pattom and hence, I could open up a conversation with him. We talked about how crazy our batches at school were, about the people in Jaipur and a lot of other things. The blasted brats and their incompetent parents (after long last) got down at Madgaon the next evening. The train was running pretty late (five and a half hours to be precise) owing to an engine failure which happened close to an hour after it left Chiplun. I finally reached Shoranur junction at 7:00 AM on Sunday morning. After a wreched two hour long ride by bus, I finally reached home! Mom, Priyamma and Ammamma gave me a warm welcome with nice, long, crisp dosas and stew for breakfast. I mowed down six dosas.
Dial-up blows by the way. For signing into blogger and putting up this post, it took me no less than forty minutes.
Although it feels great to be visiting relatives and friends (after a long time!) I kind of wish I was back at college. Guess I got used to the hectic lifestyle I'd led back there. Hope my mom doesn't see this or I might get bludgeoned with a rolling pin or something. Cheers!
Tuesday, June 10, 2008
You know someone wants a favour from you when...
NOTE: I don't know what you call such a person, so I guess I'll continue referring to them as maggots throughout this tutorial. No offence to the real maggots which are just nice little crawly creatures who want to make the world a better place.
Level 1 maggot: Loser class
Skill level: poor
Cunningness: poor
Brains: N/A
Sinister rating: 1/10
Signs: You've never had a conversation with him in your entire life, nor will you for many more lives to come, but this person actually walks into your room, sits on your bed and acts as if he's very interested in whatever you're doing. When asked, “Hey, what brings you here?”, he's dumb enough to answer, “Nothing, just dropped by to say hi, we are friends and all aren't we?”. Note, he said friends. Wrong answer. The verdict: maggot!
Comments: The one finger salute works well. Try it out.
Level 2 maggot: Grunt class
Skill level: less than average
Cunningness: less than average
Brains: Rumours are they do have some, but I still go for N/A
Sinister rating: 3/10
Signs: You're sitting in the mess, cursing your rotten luck to be served cattle feed, when the suspected maggot comes running and sits right next to you. You observe he's already had his meal. You also remember you've just given a kick ass presentation that morning. He puts his arm around you like you grew up together only to say, “Hey man! How're you doing? How's your life going?” Note that both the questions are related to you. This is a sure give away. This person has nothing to do with you at all and you're not related. Chances are, he's going to ask you to help him out with his project but he's going to play around for a while before asking you for certain, just to make you feel comfortable.
Comments: Shove your plate up his throat. And then proceed with the one finger salute.
Level 3 maggot: Striker class
Skill level: above average
Cunningness: above average
Brains: A teeny weeny bit. Or maybe not.
Sinister rating: 6/10
Signs: You know there are a lot of people in your friends list who don't give a beep about you and vice versa? That's the kind of people that we're talking about here. Now you're working away in the server room trying to figure out a solution to a problem that has long been elusive. Then, the maggot opens up a chat conversation saying, “hi”. You also note that he's got the 'I'm busy/Don't disturb/away/I'm dead' status message up. The conversation proceeds as follows:
Maggot: hi
You: hi there! ssup?
...10 seconds later...
Maggot: how are you?
... Notice the delay...
You: uh...i'm ok. Wat abt you?
Maggot: i'm fine.
... It's time to slip up you evil scum...
Maggot: wat are you workin on in the server room again?
... Gotcha!...
This is where they all go wrong. The two of you might have been in the same class for maybe two years and it's been a whole two semesters probably since you've been working in the server room and he knows it and you know that he knows it. BUT, he comes out of the blue and decides to ask you what you've been doing all along? It's strange. It's not like he woke up one fine morning and while having coffee, realisation struck, he went OMGWTF and he figured out he didn't know what you've been doing in the server room all along. I'm sorry. What he really wants to do, is to get a conversation going so he can ask you a little while later to check his grades or something of that sort. Dork.
Comments: Tell him he flunked in all his subjects and that he's got a sem back. It works great!
Level 4 maggot: Elite class
Skill level: High
Cunningness: High
Brains: Lots of it. Lots and lots of it. Or then again, I'm just kidding.
Sinister rating: 10/10
Signs: These guys are the mommy's and daddy's of all the above mentioned maggots. They're the pros. If this whole thing was Warcraft, they would be some boss like Nerzhul, the Lich King. They're pretty good at getting what they want from you. They'll plan way in advance as to get what they want from you and how they're going to go about to get it from you. Even people who rule as much as myself are prone to these things. They're a menace and we should all unite to send them to oblivion. Yet again, I'll take the example of a chat conversation but in this case, the hunter won't make it that obvious until at least half an hour.
Elite maggot: Heya... long time! Have you forgotten me kya?
You: oh hi. yeah right. long time!
Elite maggot: So what have you been doing?
You: oh nothing...just working away...
Elite maggot: i c. when're you going home?
...blah blah blah...
...blah blah blah...
...blah blah blah...
20-30 minutes later, the maggot is out of things to talk about...
Elite maggot: temme...howz ur (continued below)
Remember, all this person wants from you is the favour and he/she doesn't give a shit about you or your life, let alone your...
(continued from above) ....girlfriend? ;)
It's a 99% complete give away and this is a sign for you to become cautious. Put up your guard and be on the defense. Or better, do what I do...
You: hey...the connection seems to have some probs here. I might get disconnected any sec...
Elite maggot: wait... can you do me a favour?
And it's at exactly that instant that you turn invisible to the maggot. You have to time this right ok? It's all about practice. But do keep in mind that this depends heavily on the IM client you're using. For example, in Gtalk, it takes a while for the other person to get the message that you're offline. So it's all about preventing the maggot from knowing that you're sure there's that question coming to you.
Comments: Once you turn invisible, either block that person or ignore him/her for at least a century and a half.
So there you go folks. Hope this helps. And don't forget, squish 'em maggots! And an advice to anyone who wants a favour from me; JUST ASK!
Friday, June 6, 2008
Setting up MRTG for BSNL, Jaipur.
I finally took my network monitoring work up a level when Gaur sir asked me to go over to the BSNL head office and set up a MRTG server for the NIB (National Internet Backbone). What an opportunity! MRTG is Tobi Oetiker's (the man behind RRD Tools and Smokeping) multi router traffic grapher which is basically a tool to tell how much bandwidth your routers are using. This seems crucial for an ISP like BSNL who keep getting calls from their customers who b**** about not getting enough bandwidth. And it's really important that they have such a set up since all broadband connections to the state of Rajasthan originate from the Jaipur node where I was asked to work. I'd decided to deploy my ever favourite linux distro, Debian Etch on their server so that apt-get would make quick work out of the task at hand. Here's the roadmap I'd laid down for myself for the job:
Install a base Debian Etch-4.0.r1 with a netinstall with a fairly large and separate /var partition since all the .png files generated by MRTG are dumped into /var.
Since security is an important issue at such a level, a dist-upgrade is necessary which is meant to patch the OpenSSL security flaw that was found in Debian a couple of weeks back.
Use apt-get install apache2 to set up a webserver and configure it as needed.
Use apt-get install mrtg snmpd to set up MRTG and SNMP and the required dependencies.
Setup .htaccess for MRTG so that only privileged users can view the graphs.
Estimated time: 1.5 hours at the max.
Since I was told not to go alone, I took Yash along with me. We reached the BSNL head office at around 10:45 in the morning and after a scouring the whole office complex for around half an hour, we finally met Mr S.C Gupta, the head of the NIB (National Internet Backbone) in Jaipur. He guided us to his office and then led us into their server room which housed some seriously wicked routers and a couple of not-so-wicked servers. Quite expected actually. He showed us the server we were supposed to work on. I don't even think it was a server class machine. He'd already tried to follow the instruction manual that each head office had been sent so as to (or hoping so as to) set up MRTG on their own, and had installed Red Hat 7.1 (LOL) in it by himself as per the manual. At first, I exclaimed “Are these guys kidding me?”. But as the reader of this story will soon find out, the joke was on me. :(
I proceeded to tell Mr S.C Gupta how much Debian rules and how it's the ultimate combination of security and stability and is pretty much the best choice for running servers. He was kind of pleased with our idea and told him that the machine was all ours and we're free to do whatever it takes to get the job done. Roger that! So we proceeded to do the necessary pings to see if the server was connected to the internet and then noted down the IP address, netmask, the default gateway and the routes. Then we booted our Debian net install disc and went on with the usual procedure, did the partitioning, set up the time zones blah blah blah and set up a static IP configuration. We kidded about how this is going to be piece of cake but I guess we had spoken a moment too soon because the installer complained that it couldn't connect to ftp.iitm.ac.in to fetch packages. WTF? This was definitely a bad omen. I wondered if we'd set the network interface up correctly and we had. But it just refused to recognize the mirror. So we decided to fetch the packages ourselves after we properly configured the card once the installation of the base system was over. As soon as that was done, we realized we simply could NOT ping any host outside the LAN (after having a hell lot of problems being identified within the LAN itself, we couldn't ping our machine from other machines). What followed was a lot of trips to Mr Gupta's computer and back to see if he's given us the right details about the network which was followed by an exchange of calls between us and Gaur sir who suggested that IP forwarding wasn't enabled. It seemed kind of odd since I ran the netmon machines from this very installation disc. Then I tried it with my own Debian installed laptop but in vain. I just could not see any host outside the LAN. After a lot of attempts and reinstalls, we decided enough was enough and moved on to install Red Hat 7.1 itself :(. Yuck. I was kind of embarrassed actually. After all the hype I created around Debian. Sad.
What was supposed to be just a matter of two commands in Debian was indeed a herculean task in Red Hat. We had to fetch each of MRTG's dependencies from the net, compile and install them from source, not to mention having to manually include and link the necessary files and libraries in each case. After using links, the text based web browser we all know and love, we were able to find out the latest and available versions for zlib, gd and libpng and we successfully installed them from source inspite of having to do a lot of including and linking. Then when it was time to install MRTG, the connection of ours went down and we got awesome transfer rates of around 0-30 bytes per second. Since I hadn't brought another set of clothes, a sleeping bag and a shaving kit for myself, I decided to ssh into our college network, download it from my netmon server and scp it over to the BSNL machine and it worked like a charm. After the MRTG package was ready, it's configuration files made, the HTML template created and the MRTG binary scheduled to run every five minutes using crontab, we decided to test it. And it seemed the rotten luck which had been following us all day wasn't going to make itself scarce any time soon. We couldn't open the apache test page from Mr Gupta's browser. We ran a lot of checks on our httpd.conf and everything seemed normal. The permissions were perfect and the ownership required etc were all fine. We even tried setting up a virtual host for the job but even that was in vain. Finally, the idea dawned upon me that the firewall we'd set during installation time was set to block all incoming connections to the machine. After permitting www (http) requests to the machine and adding the prescribed set of ipchains rules, the server was good to go! We moved on to set up the finishing touches to the machine, making sure things worked even after a reboot. We then set up .htaccess and added a line to the html file saying that the maintainer was Mr S.C Gupta. Job's done!
Estimated time: 1.5 hours max.
Actual time taken: 6.5 hours flat!
All in all, an interesting experience, having had to work in a real live environment. After the ordeal, we realised we were pretty hungry because we were NOT given a single bite at the office. I went on to mow down 6 or 7 rotis (I lost count actually).
Cheers!
Wednesday, May 28, 2008
A little hack and lo! The SMS is sent.
$: gsmsendsms -d /dev/ttyS0 XXXXXXXXXX “testing”
Then came the moment of truth, as me and Rohit stood there; waiting for some form of output to appear on the screen while the cursor kept blinking, when the welcome sound of the message-received tone on Rohit's handset sounded. I leaped in joy and punched the air with my signature style. Rohit shook hands with me and told me that it seems he isn't needed anymore. :P
When I met Gaur sir a few minutes later with the good news, he told me to test the modem from Zabbix. I didn't see why that could make any difference because as far as linux supported the modem (which I'd just tested and seen for myself) , Zabbix wouldn't complain as well. But hell was I wrong!
Now while I still could make Zabbix use the gsmsendsms command (a remote command) for the alerts, it came with it's own set of problems. First of all, Zabbix won't log the remote commands and second, it won't know if the command really executed or not. This wasn't really an issue because there's no way the command could NOT work see? But the main problem was the loss in flexibility of setting up the triggers themselves. If I use the gsmsendsms command, I'd have to write the same code over and over again for different phone numbers (for the different admins) and for different triggers. This seemed very sloppy and I'm the kind of guy who likes to keep things... well... beautiful :). This meant having to get the AT commands working at all costs.
So I made a very stupid trigger which would alert me in case the hostname on the netmon machine was changed. And since Zabbix sends an alert everytime the trigger changes values, I just had to change the condition a little bit and it kept equating to true and false. Hence, I kept switching the trigger between,
{zabbix_server: system.hostname.str(netmon)}
and
{zabbix_server: system.hostname.str(X)}
As soon as I saved the trigger, Zabbix tried to send an SMS. And as I'd expected, it didn't work! It gave me the following error,
“Expected [OK], received [ERROR]”
So to figure out what the problem was, I thought I'd install minicom and try sending an SMS manually using the darned AT commands myself. It was then that I figured out the problem. Zabbix seems to use the serial port with a default baud rate. And this didn't seem to match with the baud rate of the modem itself. Although I was able to send an SMS through minicom at a baud rate of 9600 baud, I couldnt get the same to work from Zabbix, even after setting the serial port speed to 9600 baud. At that point, I got an error like this,
“Expected [OK], received [*AT+CMEE=2\rERROR]”
(The * here, was some symbol my browser couldn't identify because of lack of unicode support)
So finally I decided enough is enough and I thought I'd give the source code a little tweak. And tucked away in a little corner of the source tree for Zabbix was a file named sms.c :).
And here are the relevant contents of the code,
#: vim ~zabbix-1.4.4/src/libs/zbxsms/sms.c
typedef struct {
char *message;
const char *result;
int timeout_sec;
} zbx_sms_scenario;
zbx_sms_scenario scenario[] = {
/* 0 */ {ZBX_AT_ESC , NULL , 0 }, /* Send
*/ /* 1 */ {"AT+CMEE=2\r" , "OK" , 5 }, /* verbose error values */
/* 1 */ {"ATE0\r" , "OK" , 5 }, /* Turn off echo */
/* 2 */ {"AT\r" , "OK" , 5 }, /* Init modem */
/* 3 */ {"AT+CMGF=1\r" , "OK" , 5 }, /* Switch to text mode */
/* 4 */ {"AT+CMGS=\"" , NULL ,0 }, /* Set phone number */
/* 5 */ {number , NULL , 0 }, /* Write phone number */
/* 6 */ {"\"\r" , "> " , 5 }, /* Set phone number */
/* 7 */ {message , NULL, 0 }, /* Write message */
/* 8 */ {ZBX_AT_CTRL_Z ,"+CMGS: ", 40 }, /* Send message */
/* 9 */ {NULL , "OK" , 1 }, /* ^Z */
/* EOS */ {NULL , NULL , 0 }
};
Hmmmm, AT+CMEE=2\r eh? Verbose error values? Doesn't look to important to me. Why not turn the OK beside it into ERROR and hence, trick Zabbix into sending an SMS even if it is an ERROR? Its worth a shot. So I change,
/* 1 */ {"AT+CMEE=2\r" , "OK" , 5 }, /* verbose error values */
into
/* 1 */ {"AT+CMEE=2\r" , "ERROR" , 5 }, /* verbose error values */
I exit vim and then type the following into the console,
#~zabbix-1.4.4: make && make install
And would you believe it? It actually worked! Ha! Talk about luck. It's kind of strange that inspite of receiving an ERROR, Zabbix proceeded to send the message. Strange. Oh well, there's one case where having the source code helped.
Monday, May 12, 2008
Kernel panic anyone?
VFS: Cannot open root device “sda1” or unknown-block (0,0) Please append a correct “root=” boot option; here are the available options
0100 8192 ram0 (driver?)
0101 8192 ram1 (driver?)
0102 8192 ram2 (driver?)
0103 8192 ram3 (driver?)
0104 8192 ram4 (driver?)
0105 8192 ram5 (driver?)
0106 8192 ram6 (driver?)
0107 8192 ram7 (driver?)
0108 8192 ram8 (driver?)
0109 8192 ram9 (driver?)
010a 8192 ram10 (driver?)
010b 8192 ram11 (driver?)
010c 8192 ram12 (driver?)
010d 8192 ram13 (driver?)
010e 8192 ram14 (driver?)
010f 8192 ram15 (driver?)
Kernel panic – not syncing : VFS: Unable to mount root fs on unkown-block (0,0
Lo! The infamous kernel panic. I encountered the same problem while working on one of the college servers which was to be set up for being the new gateway. After compiling the kernel for Iptables support and rebooting into it, I got the same error, only that the available options were different. It showed the only hda device on the system that is, the CD-ROM drive.
Now after looking into a lot of forums, I decided there wasn't any clear cut solution provided on how to solve the problem. Unless you really DID append an incorrect “root=” option, the problem lies in the fact that your kernel is not able to recognize your SATA device (sda). Chances are, it's been compiled for IDE support.
The solution? Compile your kernel for SATA support.
$: cd /usr/src/linux
$: make menuconfig
Device drivers --->The options under SCSI low level drivers depend on your device. These are the options that I'd set according to my hardware. If you're not able to figure out what the right options are, select everything! As far as the gateway was concerned, I'd selected almost everything which looked sensible enough.
SCSI device support --->
<*> SCSI target support
[*] legacy /proc/scsi/ support
*** SCSI support type (disk, tape, CD-ROM) ***
<*> SCSI disk support
<*> SCSI CDROM support
[*] SCSI low-level drivers --->
<*> ACARD SCSI support
<*> Adaptec AIC7xxx Fast -> U160 support (New Driver)
(32) Maximum number of TCQ commands per device
(5000) Initial bus reset delay in milli-seconds
[*] Compile in Debugging Code
(0) Debug code enable mask (2047 for all debugging)
[*] Decode registers during diagnostics
< > Adaptec AIC7xxx support (old driver)
<*> Adaptec AIC79xx U320 support
(32) Maximum number of TCQ commands per device
(4000) Initial bus reset delay in milli-seconds
(0) Debug code enable mask (16383 for all debugging)
Finally
$: make clean && make && make modules_install
$: cp arch/x86/boot/bzImage /boot/your-kernel-version
The last step would be to update grub.
$: vi /boot/grub/menu.lst
title Your Linux
root (hd0,0)
kernel /boot/your-kernel-version root=/dev/sda1
Hope this little write up proves helpful. Cheers. Feel free to post a comment if you have any problems.
Wednesday, May 7, 2008
IV Sem: All good things must come to an end...
Well... It's been ages since I've put up a post here. A whole semester to be precise. I wouldn't attribute it to a lack of things to write about. That most certainly is not the case. I could have written about my resolutions (not for the weak hearted) or the golden night/freshers we gave our juniors. I could have even written about the new meaning to the phrase 'looking for *insert name here*
I guess I never blogged through all these months because I never had the time to do so. I don't know how, but I NEVER had any free time. This inspite of the fact that I cut down on gaming, hanging out with friends and a whole lot of other things. Perhaps, I was turning into a social outcast but fortunately, a certain lucky charm came along and I kind of snapped out of the blindness I was in. Thanks for everything Kay!
And how can I not write about the IIT-Roorkee trip? Although Cognizance wasn't even half as good as last year, it certainly came with its own moments. Of all the times they could get their project evaluations to get scheduled, the final years had to get their projects evaluated during the Chaos weekend. And hence, both our Dota teams got dissolved. Since I was planning to go for NFS:MW as well, Sat joined GaP and hence, my clan GoD, which is yet to be defeated, couldn't go to Roorkee. But unluckily for Sat, GaP got eliminated in the second round itself. Maybe they over estimated their opponents, we don't know. On the other side of the Chaos arena, I was having an awesome time with NFS:MW. I felt intimidated by some of the other participants, including a bunch who were last year's winner, runner-up and semi finalist, who carried around a little book in which they'd jotted down the best performance tunes for the Lotus Elise, the pro's choice. I'd never even tuned a car till date. But throught the tourney, I learned and made my way up the ladder. And the greatest moment of satisfaction for me, came when I was told that my games are being tracked and that I'm a seeded player! Talk about beginner's luck.
*WARNING: BRAG MODE ENABLED*
Beginner's luck my ass. I simply owned the competition. I ripped apart player after player. I'll even take some time to tell ya'll how awesome my competitive rounds were (rounds 4 and above). Round four was against a guy who insisted he played with his Xbox controller and be given headphones by the organizers. Ok, I can understand he needs his controller, but the headphones? When the organizer asked him how it's going to matter, he went on to say something about getting into the mood (???). They could only salvage one pair of headphones but when the race began, I simply left him trailing in my dust. Wonder if he got into the mood then. My split times were somewhere around 20 secs! (which means, if I stopped where I was, and he continued at his current speed, he'd take 20 seconds to reach me). In a racing game, thats comparable to the time we all took to evolve from apes. The 5th round was similar with my opponent telling me how he's got better scores in Bay Bridge than the defending champion himself. Just before the race started, he did act kind of humble though. He told me that he's a fairly decent player and he can give me a good fight. Oh well, it didn't take me too long to beat him either. I could have called it a good fight IF I'd seen him on my screen for at least 2 seconds. But alas, he wasn't even on my minimap.
*yawn*
*END OF BRAG MODE*
Then came the 6th round where I got owned by last year's runner up. Not too much to say here. N20 was disabled for the semi finals and I've never raced without that, so my strategy was ruined and hence...
Anyways, being in the top 4 ain't that bad is it?
On my return, followed a series of events which include a little chat conversation with Kay on the 1st of April, a little message from her on the 11th and finally another chat conversation on the 18th and guess what? We're going out... :p (I assure you the process was as boring and simple as I made it sound back there).
And that, was the cherry on top for my awesome semester.
I guess all good things must come to an end. So here I am, back to the server room, building up my Debian from scratch. Maybe I'll be a bit more regular with the posts now that I'll be spending the summer here working on the Campus Wide Network. In these two months, I'll be learning all the technicalities about networking while I go about setting up a DMZ for the CWN, and making high availability clusters for all our services. I've already made a cluster for the Netmon service of ours which seems to be doing fairly well. Anyways, I guess I'll start posting technical updates from now on.
Anyways, the summer heat wave awaits. Do wish me luck people.
So adios for now. Guess I'll go dig into the awesome mess food that awaits me. I'm sure you're all jealous. Suckers...