With Site24x7 API, you can edit/modify a specific monitor in an account.
Sample Request
A sample request for editing a website monitor which is associated with a group is given below:
http://site24x7.com/api/xml/editmonitor/group-name:[GROUP-NAME]/[DISPLAY-NAME]?APIKEY=[APIKEY]
Data sent as Post Parameters
&displayname=monitordisplayname&url=http://domain.com&groupname=monitorgroupname&pollinterval=10......
A sample request for editing a website monitor which is not associated with any group is given below:
http://site24x7.com/api/xml/editmonitor/[DISPLAY-NAME]?APIKEY=[APIKEY]
Data sent as Post Parameters
&displayname=monitordisplayname&url=http://domain.com&pollinterval=10......
Request URI should contain the display name and group name(if any) for which the edit operation is to be performed on.
Sample Format
<form method="POST" action=" http://site24x7.com/api/xml/editmonitor/group-name:monitorgroupname/monitordisplayname?apikey=yourapikey">
DisplayName: <input type="text" name="displayname" value="newdisplayname"><br>
URL: <input type="text" name="url" value="http://mydomain.com">
Group Name: <input type="text" name="groupname" value="newgroupname"><br>
Monitor Type: <input type="text" name="monitortype" value="URL"><br>
Poll Interval: <input type="text" name="pollinterval" value="10"><br>
EMail: <input type="text" name="emaillist" value="name@domain1.com,name@domain2.com">
SMS: <input type="text" name="smslist" value="91-32322,91-3232"><br>
Timeout: <input type="text" name="timeout" value="78"><br>
Primary Location: <input type="text" name="primarylocation" value="Singapore"><br>
Secondary Locations: <input type="text" name="secondarylocation" value="London,Melbourne"><br>
Number of failures from Location: <input type="text" name="locationfailures" value="2"><br>
Numberof failures before reporting down : <input type="text" name="maxfailurechecks" value="4"><br>
Form submission method : <input type="text" name="method" value="P"><br>
Query String : <input type="text" name="querystring" value="key1=value1&key2=value2"><br>
Basic Authentication uname: <input type="text" name="username" value="username"><br>
Basic Authentication password: <input type="text" name="password" value="password"><br>
User Agent: <input type="text" name="useragent" value="user agent"><br>
Header Name: <input type="text" name="headername" value="header name"><br>
Header Value: <input type="text" name="headervalue" value="header value"><br>
Case sensitivity: <input type="text" name="casesensitivity" value="yes"><br>
Availability string : <input type="text" name="availablestringcheck" value="availability"><br>
Availability alert type: <input type="text" name="availabilityalerttype" value="trouble"><br>
UnAvailability string : <input type="text" name="unavailablestringcheck" value="unavailability"><br>
Unavailability alert type: <input type="text" name="unavailabilityalerttype" value="trouble"><br>
RegEx: <input type="text" name="regex" value="<Regular_Expression"><br>
RegEx alerttype:<input type="text" name="regexalerttype" value="down"><br>
Response time threshold : <input type="text" name="responsetimecheck value="300"><br>
Content change threshold : <input type="text" name="contentchangecheck" value="3"><br>
MD5 : <input type="text" name="md5check" value="true"><br>
<input type="submit" value="Edit">
</form>
Request Parameters
The different parameters involved in the XML request are described below:
Field | Description |
displayname
| The display name of the monitor |
url
| The url to which the website points to |
groupname
| The
monitor group to which the website monitor belongs. You can either
enter an existing group name or a new group name. If the group name
doesn't exist, it will be created.
|
monitortype
| Type of the monitor being added. Allowed values are URL,DNS,SMTP,HOMEPAGE,PORT,PORT-POP,PORT-SMTP,PING |
pollinterval
| The
interval at which the website needs to be monitored. Allowed values are
1, 5, 10, 15, 30, 60, 120, 180, 360 and 1440. All these values are in
minutes.
|
emaillist
| The
list of email contacts associated with the monitor. If there are
multiple emails, then separate them with comma. If left alone, the
primary master email contact will be receiving any monitor-specific
alerts.
|
smslist
| The list of sms contacts associated with the monitor. If there are multiple sms contacts, then separate them with a comma.
|
timeout
| The
default timeout value for the monitor. Maximum value for a monitor with
5-min interval or above is 90 minutes and max value for a 1-min monitor
is 30 min.
|
primarylocation
| The
monitoring location from which the url needs to be checked most often.
Supported primary locations are California, New Jersey, Singapore,
Texas, Netherlands, London,
Dallas,
Seattle, Chicago, Germany, South Africa, Australia,
Nagano, Shanghai,
India
|
secondarylocation
| The
monitoring locations from where the rechecks will be done. Available
locations are California, New Jersey, Singapore, Texas, Netherlands,
London,
Dallas,
Seattle, Chicago, Germany, South Africa, Australia,
Nagano, Shanghai,
India
|
locationfailures
| The
number of failures from each monitoring location. Specify 1 if you want
alerts when monitor fails to respond from 1 location, 2 if you want it
to check in 2 locations and vice versa. Max. value is 3.
|
maxfailurechecks
| The number of failures allowed before the site is reported as 'Down'. Values from 1 to 5. |
method
| The
form submission method for the http/https url. Allowed values are P, G
or H. P for a POST request, G for GET request and H for HEAD request.
|
querystring
| If the form submission method is POST, then specify the query string in this field. sample: param1=value1¶m2=value2¶m3=value3....
|
username
| The username of the website (if the site requires basic authentication) |
password
| The password of the website (if the site requires basic authentication)
|
useragent | User agent to be used with the request |
headername | Maximum of 10 custom headers can be sent with the request.
|
headervalue | header value corresponding to the header name specified in the headername list.
|
casesensitivity
| To check the content matching keyword with case sensitivity. yes / no values will be allowed. |
availablestringcheck
| The
keywords/key phrases whose presence needs to checked for. To check
multiple keywords, specify them separated by a space. If you want to
test for a phrase, specify the phrase within double quotes. sample: string1 string2 "This is a phrase" "This again is a phrase" string3
|
availabilityalerttype
| This will send appropriate alert when content matching fails. trouble / down values will be allowed. |
unavailablestringcheck
| The
keywords/key phrases whose absence needs to be checked for. To check
multiple keywords, specify them separated with a space. If you want to
test for a phrase, specify the phrase within double quotes. sample: string1 string2 "This is a phrase" "This again is a phrase" string3 |
unavailabilityalerttype
| This will send appropriate alert on content matching succeeds. trouble / down values will be allowed. |
regex
| To check the response
content to match the regular expression pattern. Configure a Java based
regular expression to check the content. |
regexalerttype
| This will send appropriate alert on regular expression does not match. trouble / down values will be allowed.
|
responsetimecheck
| The threshold value set for response time. This value will be in milliseconds. Eg: 3000 3000 will be for 3 secs
|
contentchangecheck
| The threshold value set for content change notification. This
will be depicted as the percentage change in the size of the web page.
If you want to be alerted if the size of the web page changes by 20%
then specify 20 in this field. Eg: 20
|
md5check
| The value to be specified to check if the web page has been modified. Allowed values are "true" or "false" |
Sample Success Response
<response uri="/api/xml/editmonitor" action="AddURL"> <result> <response>Successfully Edited Monitor</response> </result> </response> |
Sample Error Message
If there is an error in executing the action, you get an appropriate error response as shown below:
<response uri="/api/xml/editmonitor/monitordisplayname">
<error>
<code>2601</code>
<message>
The specified monitor is not present in Site24x7. Check if [displayname] is correct.
</message>
</error>
</response>