Archive for May, 2008

Getting Windows HDD usage with PHP and SNMP

At work a couple of months back I was faced with a problem that many of our servers would run out of hard drive space without us knowing and that would cause the server to hang and/or stop responding. So I did a bit of research and came across. This little utilility would run on the server in command line and tell you what drives were available and some info of the drives like space used and available. Well with this I would echo out the data to a text file and send that across to a common holding ground. Then from there get my web server to constantly scan this folder for new logs. This method worked but it had its issues.

Well yesterday at work I was playing around with SNMP and after finding a site with W2K MIBS I found lots of info you can pull from the server. Now I was already familiar with SNMP in PHP thanks to their documentation on their site. So using their snmpwalk function I was able to pull the relevant data to get HDD usage info.

$names = snmpwalk($row['ip'], "public", '.1.3.6.1.2.1.25.2.3.1.3');
$used = snmpwalk($row['ip'], "public", '.1.3.6.1.2.1.25.2.3.1.6');
$total = snmpwalk($row['ip'], "public", '.1.3.6.1.2.1.25.2.3.1.5');
$alloc = snmpwalk($row['ip'], "public", '.1.3.6.1.2.1.25.2.3.1.4');

Now that would give me an array of drive names, space used on those drives, total space available on those drives and the allocation units. Now the allocation units I didn’t realize I needed as I thought the numbers given in used and total were just measured in bytes but they aren’t. The numbers in used and total are how many blocks of allocation size (if that makes sense). So to get the true byte value from used and total you need to multiply them by the allocation size number.

25599569 * 4096 = 104855834624B = 97.65GB

So there you have it. Now you know how to get HDD usage from your server using PHP and SNMP.

Healthy Living - Obviously Not

So I was in Tesco’s and just about to get to the cashier and my friend James notices that the cashier is wearing a healthy living T-Shirt. “Well isn’t that ironic” he says, well the picture speaks for its self.

Healthy Living - Yeah Right!

Just what are Tesco thinking to give this poor lady a top advertising healthy living when she clearly hasn’t being doing just that?

Cheating Wife put on Ebay

All I can say is LOL

Cheating Wife put on Ebay Cheating Wife put on Ebay Cheating Wife put on Ebay

Reason 89 to Shop at Morrisons

I don’ know if you remember those Morrison’s adverts where they gave a list of reasons why to shop at Morrison’s? Well firstly they would show a clip of something good about their store, for example fresh bread. Then after showing the clip they would say “Reason 32 to shop at Morrison’s” and this was just one of the adverts as each advert would have different reasons. Presumable they had lots of reasons why you should shop their but they only showed the best reasons on TV.

Well anyway I was out walking around York with my friend Dan and he shouts out “Reason 89 to shop at Morrison’s as we are opening a store near you”. I’m like “You what?”. Well as it goes a Morrison’s store was being built right near where we were walking.

Reason 89 to Shop at Morrisons

This photo is old and now the store has been open for awhile. So why have I posted this? Well I just found it witty what my friend said :)

Sainsbury’s Recommended Reads

Ok this is an old photo that I’ve had on my phone for some time now but I took it for a reason. I was stood in the queue at Sainsbury’s and noticed the recommended reads stand. Now what made me laugh that at one side was kids books and at the other end was just gardening magazines, but at the top “FHM 100 Sexiest Women”. Now obviously someone hasn’t really thought out what they put on that stand. Who picks what goes on there? I suppose at least they had some brains to put the magazine on the top shelf of the stand.

Sainsbury’s Recommended Reads

This post isn’t a complaint or anything but it’s just one of those things that made me laugh.

Didn’t get the Job

Oh well I didn’t get the job :( but I did get this responce:

Hi Scott,

Further to our telephone call today, I wanted to say that we were very
impressed with your attitude and your skills, and it wouldn’t be out of
the question for us to give you a call in the future for some part-time
work or freelance work. We thought you had an excellent CV, and came
across well in the interview.

If it’s OK with you, we’d like to keep your details on file, and
hopefully be in touch soon.

Many thanks,

Chris

Big Update Continued

So now you’re looking at the Managing Director of Alpha Ready LTD, got it all set up and also an account to deal with all expenses and sort out all taxes etc for end of year. I’m on my way to making a million pounds :P

Well not is all good, recently we have just been hit with some bad news at work. The IT director has been replaced. We were all in shock most of the day as we couldn’t believe what we were hearing. Straight away I’m like oh no the old IT director hasn’t finished sorting out making me a supplier so I contract to Ford Retail.

Ok big pause to reflect what has just happened……….

Ok well can’t just sit around and wait for things to happen. I don’t know much about the new IT director and I don’t know what he wants to do with the IT department, will he still require my type of work? Will he take on my limited company? So just in case I end up without a job I’ve been looking for other jobs.

I found a job offer for a web design company just starting out. They have rented out office space in York Science Park, a new complex purposely built for small companies starting out related to IT. Anyway I have been for an interview. Felt it went well but don’t know if I’m what they are looking for. We will find out in a week…. The job sounds really interesting and it would be nice to work with likeminded people. Where I work at the moment I’m the only one that deals with web related work and so forth can’t talk about my work or turn to other members of staff for help. There is no team work at Ford Retail and that’s why I would really like this job at the web developing firm as we will be working as a team to get the work done.

To be continued…

Big Update

So I haven’t updated in a long time and because so much has happened since my last time I’m going to write just a little of everything, keeping it sort and sweet.

So if you don’t already know I’m now living back in York. I had enough of Leeds, it was making me depressed and the atmosphere there was far too much rush rush! The city center was far too busy and everywhere you looked there were high rise buildings. Back in York I find it so much more peaceful, plenty of places to relax in the sun.

 

In York I have a nice 2 Bedroom apartment, one bedroom with en-suite, bathroom, very large kitchen and front room. Dropped on a right barging and already had friends over for dinner. Only thing is I need some front room furniture but for the time being I can’t afford any.

At work things seem to be going well. The IT director is very impressed with my work. As I’m going through the agency I’m not getting great pay and Ford Retail are paying more for me through the agency. So the It director came to me to set up a limited company so that I contract to Ford Retail. That way I get a better wage and Ford Retail same some because they are not paying as much to the agency. So after a week or so I got all set up with my limited company.

To be continued…..