cancel
Showing results for 
Search instead for 
Did you mean: 

AppDynamics Javascript Injection iRule for monitoring

Viv_Richards
Cirrostratus
Cirrostratus

Herewith iRule for AppDynamics Javascript Injection iRule

In this iRule /title has been replaced and javascript has been injected

======================================== 

when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/"}{
set enableEum 1
HTTP::header remove "Accept-Encoding"
}
# Disable the stream filter for client requests as we are only interested in the server response
STREAM::disable
}
when HTTP_RESPONSE {
STREAM::disable
if {($enableEum == 1) && ([HTTP::header "Content-Type"] starts_with "text/html")}{
STREAM::expression "@</title>@</title><script>window\[\'adrum-start-time\'\] = new Date().getTime();(function(config)\{config.appKey = \'EEE-EEE-EEE\';config.adrumExtUrlHttp = \'http://cdn.appdynamics.com\';config.adrumExtUrlHttps = \'https://cdn.appdynamics.com\';config.beaconUrlHttp = \'http://col-eum-abcd.com\';config.beaconUrlHttps = \'https://col-eum-abcd.com\';config.xd = \{enable : false\};\})(window\[\'adrum-config\'\] || (window\[\'adrum-config\'\] = \{\}));</script><script type=\'text/javascript\' src=\'//cdn.appdynamics.com/adrum/adrum-latest.js\'></script>@"
STREAM::enable
}
}

============================ 

Stream profile also required for this. 

This iRule has been tested and working successfully 

Regards

3 REPLIES 3

LiefZimmerman
Community Manager
Community Manager

@JRahm - looks to me like @Viv_Richards (thanks Viv_Richards) has a good candidate for CrowdSRC codeshare?
If you agree - let's nominate this up.

------
Lief ZimmermanLiefZimmerman | @LiefZF5 | DevCentral Community Manager

JRahm
Community Manager
Community Manager

for sure...clever use of the stream profile!

LiefZimmerman
Community Manager
Community Manager

Cool - thanks @JRahm.
I nominated this to become a CrowdSRC codeshare article @Viv_Richards.

PS. Getting a "clever" rating from Jason is, IMO, a feather in your cap. 🎓

------
Lief ZimmermanLiefZimmerman | @LiefZF5 | DevCentral Community Manager