How to monitor disk space in Linux boxes
Sometimes, you will need to monitor your disk space on some linux servers in your network. You may install monitoring tools like Zabbix, however this may be too much, may be you just need to monitor disk usage on the box. You can use this script to e-mail you every morning with the disk usage on the box:
#!/bin/sh
address="root@localhost";
cicl="2 3 4 5 6";
# ?????????? ? ????????? ????? ???????????? ????? ??? ??????? ???????,
# ??? ??????? ?????????? ?????????
predel[2]=80; # /
predel[3]=80; # /usr
predel[4]=60; # /var
predel[5]=80; # /tmp
predel[6]=80; # /home
varning=”0″;
count=0;
df -h > /tmp/tmp_df;
while read -r FS S Ud A U MO; do
let count+=1;
FileSystem[$count]=$FS;
Size[$count]=$S;
Used[$count]=$Ud;
Avail[$count]=$A;
Use[$count]=$U;
MountedOn[$count]=$MO;
NUse[$count]=${Use[$count]%”%”};
done < /tmp/tmp_df;
table=”";
for c in $cicl; do
if [[ ${NUse[$c]} -ge ${predel[c]} ]]; then
varning=”1″;
table=$table”n${FileSystem[$c]} t${Size[$c]} t${Used[$c]} t${Avail[$c]} t${Use[$c]} t${MountedOn[$c]}”;
fi
done
shapka=”nFileSystem tSize tUsed tAvail tUse tMounted On”;
body=”Regard admin, please check, place on disk:”$shapka$table;
#echo -e $body;
if [ $varning -eq "1" ];
then
echo -e $body | mail -s”Warning on server” $address;
logger -i -p cron.warn -t dfmonitor “Send warning to $address”;
else
logger -i -p cron.info -t dfmonitor ” Place on disk in rate”;
fi
You can call this shell script whatever you want and don’t forget to add this into your crontabs.
The script is courtesy of OpenNet.Ru
Free fonts for your applications
Sponsored Post
When developing a website or a web applications we sometimes need different fonts to be used then the usuals. Be it just navigation buttons, site slogan or a CAPTCHA code. At Urban Fonts you can download free fonts for your usage, or if it is not enough you can browse through paid ones, pick the right font for your application and buy it online!
The website, unlike other free font offering websites, is designed very user friendly. The fonts are organized in alphabetic format for your convenience, and has a preview when you mouse over them. You can even browse through authors and pick the fonts which he designed. You can check out the latest additions to the font collection and their favourites picks.
Especially, I loved that it is clearly stated for which fonts you have to pay and which fonts you can just download for free. Now, let’s be honest, everybody likes freebies!
Paid fonts can be purchased for a $24 USD and gives you much more options then the free fonts.
Urban Fonts has a blog and a forum to help with the PR.
So if you are a web designer, web developer or just looking for free and yet quality fonts, Urban Fonts has it all for you!
Why server side validation is important or why spammers love JavaScript validations
It was those days when you could just leave your email out there, have contact, registration and etc forms without any forced validations, only few companies like Yahoo! had CAPTCHA validations…
Yes, those were the days! But now we have JavaScript, CAPTCHA, Audio, Server Side validations to avoid spam and misuse of the forms.
Now, when you are preparing a simple contact form which will email you submissions or feedback form for your company, order forms etc it is come to a point where JavaScript validation is not sufficient. Spammers do love JavaScript validations because they can just bypass them easily. Try it yourself, go find that kind of contact forms and disable JavaScript on your browser and just hit Submit button. See, it says submitted successfully. Read more
Exabytes and time
I was doing one freelance work where I had to use LAMP technology. So my client has ordered hosting from Exabytes. Interestingly I had some bugs on theirs servers. I digged some more and I find out that their PHP time is wrong. Here’s the screenshot:
As you can see from the screenshot the server shows a date with more then 1 day difference! Well, I’ve never bothered to check if the servers were from US or local, I was under impression that they were local. Well, seems like not! So that’s how I get a almost a day difference in dates!
I used very basic date functions to get the date shown on their servers. The code is taken from php.net and now I need to add the difference to get Malaysian time.
I will post my solutions here, stay tuned!
Update: I used very simple code:
$h = “-8″;// Hour for time zone goes here e.g. +7 or -4, just remove the + or -
$hm = $h * 60;
$ms = $hm * 60;
if (!$date) {
$date=date(”Y-m-d”);
$getdate = gmdate(”Y-m-d”, time()-($ms));
}
ATM Monitoring in Ambank
Recently, I had the opportunity with three other vendors/freelancers to come up with a solution for their M$ ACCESS based “application” which record downtime of their ATMs. Basically it’s a .mdb file which is shared on a ms win server folder.
Before everything else, I was surprised how they “monitor” their ATM machines! They literally watched the ATM reporting screen to see if the ATM was down. I mean, a person is allocated for this task - just sit and stare at the monitor, if the ATM status goes down he needs to open their “application” and enter the downtime.
Anyway, they did a small presentation of their usage of this “application” and their expectation. They wanted some applications which will replace theirs. “Replace” not as in enhance or add-on new functions. They just want to keep the way they “monitor”.
I must note that I was contacted long before this meeting with regard to this matter and I was planning to use Perl/Shell scripting in Linux to do all of this with a LAMP interface for reporting purposes. But, it turns out that all their infrastructure as well as IT team is pro-Microsoft. What to do? They just want it in some Microsoft .NET or Visual Basic (is it the same now?). So, unfortunately we fail.
We proposed to them a fully automated uptime/downtime tracking facility with auto generation of reports in Excel/PDF.
What I don’t understand is why they find it all right to have somebody just sit and watch the ATM monitor screen. It’s wasting resources for nothing, instead of hiring/training a person to use Open Source stuff and make everybody’s life easy?
And, of course, some extra cash for me?
