New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Need an uptime button/script
I'm looking just for a simple button like host-tracker.com provides.
But I'm just looking for a small button which is green if the server is up and red when the server is down. If've already seen the scripts here but these are a bit "overloaded" for me. I hope I explained me problem good enough.
Comments
Can it be more simple than simple ping scripts from @trexos and @clone1018
@trexos -> http://lowendtalk.com/discussion/12128/simple-php-ping-script-you-only-need-1-web-server/p1
@clone1018 -> http://lowendtalk.com/discussion/comment/298181/#Comment_298181
Thanks for the suggestions but that's a bit overloaded for me. I just have a small VPS where already enough services are running. So I wanted to avoid installing php.
And I wanted to show visitors the button. I'm looking just for a small dot which should change its if the host is down or up.
I don't see how you can do this without php. (The servers you are checking don't need anything installed, only the webserver where you host this script)
See my sig for example, only my dedi got a web server installed.
Maybe there is a website which provides this.
Do I need anything else to install this? MySql? Can I check if some other services are running too?
Well, you can have a cron job that runs every minute, if host is up it does cp green.png button.png or if host is down it does cp red.png button.png.
So here's an example that should work, if using ping:
Edit: doesn't have to be cron job:
If you want more complicated things and still for some reason don't want to install PHP, then you could write a C++ program instead of bash script (although bash probably is just as good if you know how to code it well, I certainly don't ; compile it on your computer and then upload to server, and add it to cron. If you have some specific service in mind, probably external service would be better.
By the way, in scripts above, you'll need #!/bin/bash to make sure it executes properly.
You only need a webserver (I would suggest nginx) and PHP. You don't need MySQL or something else.
Graphs?
http://royal.pingdom.com/2010/02/04/pingdom-shareable-uptime-banners-with-graphs/
Lighty on mine
Thanks to @perennate for the script! Do you know how I can show the button on my website? What do I need to add to my html code?
@perennate
Your script always return TRUE.
if [ "$(ping -q -c1 yourIP | grep "1 received")" ]
It would be correct.
@Spirit, I have one too!
http://pinger.droidzone.in
Once again, php is needed..sorry, OP. You'd probably be better off with somthing like what @perennate wrote.
@joelgm I know about your work and it looks damn nice but we can't consider it for usage until release
I don't know whether it is related to your task, but I had once created a script that runs on the server and keeps logs of its uptime periods (Unix epoch of boot and assumed length of uptime).
@perennate - interesting approach and idea.
I'm having difficulties creating a foolproof installer.
Check out bash sockets - you can do some neat stuff that goes beyond simple pings/etc
e.g for a host/port monitor:
perennate's idea of using an image is a good one so you could throw that in there also. Note that this might not work on Debian unless you've recompiled your bash (I think Debian still compiles bash with –disable-net-redirections by default)
instead of cp'ing why not just link, less IO
ln -sf green.png button.png
Well, I think it's totally unnecessary to copy an image or link an image. You could simply change the style and create a css button.
<span class="statusbtn">Online</span>
And:
.statusbtn { color: #FFFFFF; text-align: center; width: 93px; -moz-box-sizing: border-box; display: block; background-image: linear-gradient(to bottom, #269B47, #1CEF58); }
Produces:
And do a sed on the stylesheet to replace the color of the indicator.
Ah, I tested it with unknown host, you're right it doesn't send error if it only fails ping. @typh0n you should change to what Strikerr posted.
.. and obviously button.png might be cached by your isp, browser, cdn etc. so that might not work
.. and obviously you could use sed on HTML to change it instead or add Cache-Control: no-cache or similar header, so it would work.
Can you please share the script so that I can host on my end to monitor my VPS?
It's due for release today, probably in the next hour or so. I'm doing the final part of the setup script.
Ok, Geekping is officially released.
Get it here: http://repository.droidzone.in/
button.png?nocache=$timestamp
SiteUptime.com might work for you, the button doesn't turn red if its down but they e-mail you when its down. free service. 1 site only (they profit off upgrades). ive been using em for 3+ years. i like it.
button looks like this: http://btn.siteuptime.com/genbutton.php?u=109052&m=90960&c=green&p=total