A unique and specific requirement came my way a while back that I'd like to share. Although Cisco ACE is going EOL, they are not gone yet, so i guess some may find this useful. I was asked could an ACE probe a HTTP page for it's timestamp and fail the probe if the timestamp of said file had changed.
The fundemental requirement was that if the timestamp of this one file kept changing then the application had an issue and therefore the ACE VIP should be taken out of service or perhaps HTTP traffic was to be diverted to a maintenance page.
The ACE platform is not able to probe the timestamp of a webpage directly, so we had to use a custom script on the webserver to get this information a feed it back to ACE when requested. In this example we are using PHP, but most server-side languages should be able to generate the requested informaion.
The first and most important thing when writing code is to write up some pseudo code. This will give you an guide line to following when actually writing the required code.
1. write server side code to get timestamp from specific file and return value in specific format
2. write standard ACE TCL code, including debug settings
3. define variables and defaults if required
4. create http request to rserver and get output from custom server-side script
5. format outputted timestamp to tcl readable integer for calculation
6. store the lastest iteration of the retrived timestamp in a variable to be used the next time the TCL script is run (this is for comparison)
7. calculate difference in timestamps from previous iteration to this current iteration
8. if difference is 0 (no changes), if it greater than 0. thats a change to the monitor application file and therefore an error so probe is failed
From here the determine probe failure thresholds and values at the probe configuration directly on the ACE CLI. This script can be used a guide line on how to create your own custom scripted probe or you can use this one itself. As with all code, there is room for improvement here, with more check and balances unique to your requirement. This is not the finalised code that was implemented due to intellectiual property considerations.
time.php (server-side script)
// set timezone
// get file timestamp and output is specific format