Uptime calculation via Hudson + SiteMonitor Plugin
The uptime is the percentage of time that one site is reachable, sometime uptime is a measure regulated by a contracts, in that case is important to track it.
We need Hudson up and running with the SiteMonitor plugin installed.
Every builds the site monitor checks if a site is up, if it is the build is succesfull otherwise it fails.
This info is tracked in the build logs, so with a script we can calculate the number of succesfull builds over the total builds.
Here is the shell script
cat `find . -name log -mtime -30` | grep Finished >m$$
mtot=$( cat m$$ | grep -c Finished );
msuc=$( cat m$$ | grep -c SUCCESS );
mper=$(echo "scale = 3; $msuc/$mtot" | bc)
echo Last 30 days = $mper