Since we have started to use AppDynamics for our application I’ve installed an extension to monitor urls, to check if they up, check the return status code and so on.
But since AppDynamics supports not only Java extensions but also scripts I wrote this small script which monitors the provided URLs. This way seems to be easier to support and extend comparing to Java, because you don’t need open Java project each time to want to modify something in it or add new metrics.
This script uses Ruby 1.8.
Shell script
Since the logic is in ruby shell script is just a wrapper for it, so it should just run ruby script:
Monitor.xml
This file is almost the same for every monitor, it basically tells machine agent how to execute the script. You can find more details in step 7 of original documentation. For my monitor it looks like this:
Now you just need to put these files under monitors folder and restart machine agent. Metrics will be available under Custom Metrics|Urls|<urlName>