An AppDynamics Machine Agent extension to visit a set of URLs and report whether they are up or down (and optionally whether certain text patterns appear on those pages).
This extension requires the Java Machine Agent.
- Download UrlMonitor.zip from the AppDynamics Community.
- Copy UrlMonitor.zip into the directory where you installed the machine agent, under
$AGENT_HOME/monitors
. - Unzip the file. This will create a new directory called UrlMonitor.
- In
$AGENT_HOME/monitors/UrlMonitor
, edit the configuration files (monitor.xml
andconfig.yaml
) to configure the plugin. - Restart the machine agent.
Every AppDynamics extension has a monitor.xml
file that configures the extension. In this case, the monitor.xml
for this extension just has a single option: the path where the extension can find the main config.yaml
file.
Note that the path is relative to $AGENT_HOME
.
<task-arguments>
<argument name="config-file" is-required="true" default-value="monitors/UrlMonitor/config.yaml" />
</task-arguments>
The main configuration for this extension then lives in a file called config.yaml
. It uses a simple syntax that anyone can edit with a simple text editor. Here's a sample:
clientConfig:
maxConnTotal: 1000
maxConnPerRoute: 1000
ignoreSslErrors: true
userAgent: Mozilla/5.0 AppDynamics-UrlMonitor/1.0.6
defaultParams:
method: HEAD
socketTimeout: 30000
connectTimeout: 30000
numAttempts: 3
treatAuthFailedAsError: true
sites:
- name: Google
url: http://www.google.com
groupName
- name: AppDynamics
url: https://www.appdynamics.com
- name: My Slow Site
url: http://www.wordpress.com
connectTimeout: 60000
- name: Help
url: https://help.appdynamics.com
proxyConfig:
host: www.proxy.appdynamics.com
port: 8080
- name: My Controller
url: https://mycontroller.saas.appdynamics.com/controller/rest/applications
username: demouser@customer1
password: welcome
- name: My POST site
url: http://localhost:8293/api/v1/metrics
username:
password:
connectTimeout: 60000
method: POST
headers:
Content-Type: application/json
requestPayloadFile: src/test/resources/conf/postrequestPayloadFile
matchPatterns:
- name: Error
type: substring
pattern: Error 400
Increase the timeout threshold for a site that is often slow:
- name: My Slow Site
url: http://www.wordpress.com
connectTimeout: 60000
Supply a username and password for HTTP Basic authentication:
- name: My Login Page
url: http://localhost:8090/controller/rest/applications
username: demouser@customer1
password: welcome
Retrieve the Google home page and make sure the "I'm Feeling Lucky" button is visible:
- name: Google
url: http://www.google.com
matchPatterns:
- name: LuckyButton
type: substring
pattern: I'm Feeling Lucky
Retrieve the Google home page and count how many times the word "Mail" appears:
- name: Google
url: http://www.google.com
matchPatterns:
- name: MailCount
type: word
pattern: Mail
POST xml or json payload to any url and search for the patterns in the response
- name: My POST site
url: http://myposturl
method: POST
headers:
Content-Type: application/json
requestPayloadFile: path/to/postrequestPayloadFile
matchPatterns:
- name: Error
type: substring
pattern: Error 400
The clientConfig section sets options for the HTTP client library, including:
Option Name | Default Value | Option Description |
---|---|---|
maxConnTotal | 1000 | Maximum number of simultaneous HTTP connections |
maxConnPerRoute | 1000 | Maximum number of simultaneous HTTP connections to a single host |
threadCount | 10 | Maximum number of Threads spawned to cater HTTP request |
ignoreSSlErrors | false | Whether to ignore errors in SSL certificate validation or host validation |
userAgent | Mozilla/5.0 (compatible; AppDynamics UrlMonitor; http://www.appdynamics.com/) | Custom User-Agent header to send with requests (can be used to mimic desktop or mobile browsers) |
followRedirects | true | Whether the client should follow Redirect responses |
maxRedirects | 10 | Maximum redirects |
The defaultParams section sets the default options for all sites. These options can then be overriden at the individual site level.
Option Name | Default Value | Option Description |
---|---|---|
method | GET | HTTP method to use (e.g. GET, POST, HEAD, OPTIONS, etc.). The default is "HEAD", which avoids the overhead of retrieving the entire body of the response, but which prevents the agent from doing pattern matching or reporting the response size. Make sure you set the method to GET if you want these features. |
socketTimeout | 30000 | Maximum time to wait for a socket connection to open, in milliseconds |
connectTimeout | 30000 | Maximum time to wait for the HTTP handshake, in milliseconds |
numAttempts | 1 | Number of times the site will be retrieved. The metrics then reported will be an average over all attempts. |
treatAuthFailedAsError | true | If false, the extension will report the site status as "SUCCESS" even if authentication fails. |
proxyConfig | null | Specify the host and port of the proxy. |
Option Name | Default Value | Option Description |
---|---|---|
host | none | proxy host |
port | none | proxy port |
username | none | proxy username |
password | none | proxy password |
Option Name | Default Value | Option Description |
---|---|---|
name | none | Name of the url with which metric folder that will be created in Metric Browser |
url | none | The url to monitor |
username | none | username if url has Basic Authentication |
password | none | password if url has Basic Authentication |
matchPatterns | none | match patterns to search for in the response |
Option Name | Default Value | Option Description |
---|---|---|
name | none | Name of the metric folder that will be created in Metric Browser |
pattern | none | The string to search for |
type | substring | Can be one of: substring, caseInsensitiveSubstring, regex, or word (see below) |
The options for the pattern type are:
Value | Meaning |
---|---|
substring | Exact match on the given string |
caseInsensitiveSubstring | Case-insensitive match on the given string |
regex | Regular expression match |
word | Case-insensitive, but must be surrounded by non-word characters |
- Average Response time (ms)
- Response Bytes
- Response Code
- Status : UNKNOWN(0), CANCELED(1), FAILED(2), ERROR(3), SUCCESS(4)
For any questions or feature requests, please contact the AppDynamics Center of Excellence.
Version: 1.2.3
Controller Compatibility: 3.7 or later
Last Updated: 07/28/2016
Author: Todd Radel
Always feel free to fork and contribute any changes directly via GitHub.
Find out more in the AppDynamics Community.
- Fixed metric drop issue in case of large number of URLs
- Corrected issues with ignoreSSLErrors functionality.
- Added POST functionality.
- Added pattern matching against the retrieved pages.
- Version bump
- Added metadata for new extension repository.
- Rebranded as url-monitoring-extension.
- Added new config option
treatAuthFailedAsError
. If false, then 401 errors will be expected and treated as "OK" result.
- Replaced Apache HTTP Component library with Ning Async HTTP Client.
- Added support for self-signed SSL certificates.
- Initial release to AppSphere.