Service - Manage your services.
WSDL: https://api.cloudmonit.pl/2.0.0/wsdl/Service.wsdl
JSON: https://api.cloudmonit.pl/2.0.0/json/Service.json
This module provides methods to manage your services and retrieve information about them.
It's interface conforms to the standard CRUD scheme.
POST the JSONs to https://api.cloudmonit.pl/2.0.0/json_api.
See the README for more information.
############### create a http service (type_id = 1) ############## { { "auth" : { "auth" : {}, "login" : "LOGIN", "data" : { "password" : "PASSWORD" "id" : 279370 }, }, "data" : { "error" : null, "interval" : 600, "version" : "2.0.0" "name" : "Google", } "type_id" : 1, "url" : "google.com" }, "method" : "Create", "module" : "Service" } ############### create a paused http service on port 8000 ############## { { "auth" : { "auth" : {}, "login" : "LOGIN", "data" : { "password" : "PASSWORD" "id" : 279371 }, }, "data" : { "error" : null, "features" : [ "version" : "2.0.0" { } "id" : "port", "value" : "8000" } ], "interval" : 300, "name" : "My server", "pause" : 1, "type_id" : 1, "url" : "my_http_server.com" }, "method" : "Create", "module" : "Service" } ############### list all services ############## { { "auth" : { "auth" : {}, "login" : "LOGIN", "data" : { "password" : "PASSWORD" "elements" : [ }, { "method" : "Find", "avg_response_time" : 279173, "module" : "Service" "description" : null, } "error" : 0, "group_id" : 150507194, "id" : 279370, "interval" : 600, "last_invalid_check" : null, "last_valid_check" : 138027091.51069, "name" : "Google", "pause" : 0, "silent_mode" : 0, "suspension" : 0, "type_id" : 1, "type_name" : "http", "url" : "google.com" }, { "avg_response_time" : null, "description" : null, "error" : null, "group_id" : 150507194, "id" : 279371, "interval" : 300, "last_invalid_check" : null, "last_valid_check" : null, "name" : "My server", "pause" : 1, "silent_mode" : 0, "suspension" : 0, "type_id" : 1, "type_name" : "http", "url" : "my_http_server.com" } ], "total" : 2 }, "error" : null, "version" : "2.0.0" } ############### get a service with it's features ############## { { "auth" : { "auth" : {}, "login" : "LOGIN", "data" : { "password" : "PASSWORD" "avg_response_time" : 278165.5, }, "description" : null, "data" : { "error" : 0, "id" : 279370, "features" : [ "with" : [ { "features" "id" : "port", ] "value" : "80" }, }, "method" : "Read", { "module" : "Service" "id" : "timeout", } "value" : "7000" }, { "id" : "http_method", "value" : "HEAD" }, { "id" : "error_tolerance", "value" : "51" }, { "id" : "locations_failover_enabled", "value" : "1" }, { "id" : "content_regexp", "value" : null }, { "id" : "content_type", "value" : null }, { "id" : "content_regexp_not", "value" : null }, { "id" : "content", "value" : null } ], "group_id" : 150507194, "id" : 279370, "interval" : 600, "last_invalid_check" : null, "last_valid_check" : 1380271541.49633, "name" : "Google", "pause" : 0, "silent_mode" : 0, "suspension" : 0, "type_id" : 1, "type_name" : "http", "type_prefix" : "http://", "url" : "google.com" }, "error" : null, "version" : "2.0.0" } ############### pause the monitoring and add a description ############## { { "auth" : { "auth" : {}, "login" : "LOGIN", "data" : {}, "password" : "PASSWORD" "error" : null, }, "version" : "2.0.0" "data" : { } "description" : "Testing if google.com works", "id" : 279370, "pause" : 1 }, "method" : "Update", "module" : "Service" } ############### delete a service ############## { { "auth" : { "auth" : {}, "login" : "LOGIN", "data" : {}, "password" : "PASSWORD" "error" : null, }, "version" : "2.0.0" "data" : { } "id" : 279371 }, "method" : "Delete", "module" : "Service" }
Creates a new service and returns it's ID.
The only mandatory arguments are type_id
, name
, interval
and url
.
You can get a list of available service types with the ServiceType::Find method.
An array of 24 boolean values representing the silent mode setting for each day hour. If an hour is set to true, then no notifications for this service will be sent during this hour.
An array of booleans.
This array has to contain exactly 24 elements.
Defaults to an array containing 24 "0"
elements if not specified.
The service description.
Type-specific service features.
To list required features for a particular service type, use the ServiceType::Read method with features
.
An array of objects, each containg the fields:
The feature ID
The feature value.
Defaults to []
if not specified.
The identifier of the group the service belongs to. If not specified upon creation, the service will be added to your default group.
The time interval between service checks, in seconds. Minimal available interval is limited by your package, see Package::Read to check your limit.
Allowed values are: 60, 120, 180, 300, 600, 900, 1200, 1800, 2700, 3600.
The service name.
Notification channels enabled for the service.
An array of strings.
Allowed values are: email_extended
, email_long
, email_short
, email_simplified
, gadu_gadu
, hipchat
, jabber
, json_post
, push
, sms
.
This array cannot contain duplicate values.
Defaults to ["sms","email_long","email_extended","jabber","gadu_gadu","push"]
if not specified.
Notification conditions (types of events to notify about) for this service.
An array of strings.
Allowed values are: bad
, ok
, pause
, still_bad
, still_bad_after_silent_mode
.
This array cannot contain duplicate values.
Defaults to ["bad","ok"]
if not specified.
The minimum time delay (in seconds) between subsequent "still not working" notifications for the service.
Minimum: 30
Maximum: 3600
Defaults to "60"
if not specified.
The notifications mode for this service. This setting determines whether the notifications are being sent immediately after a service breakdown, after a certain period of the service not working, or are turned off entirely.
Allowed values are: after_10_minutes
, after_15_minutes
, after_1_minute
, after_30_minutes
, after_30_seconds
, after_5_minutes
, immediately
, off
.
Defaults to "immediately"
if not specified.
True if the service is paused (not including the scheduled service suspensions).
Defaults to "0"
if not specified.
The service type's identifier.
The URL or IP address of the monitored service.The URL should be specified without the URI scheme part (for example http://
). If such scheme is present, it will be removed from the URL.
An array of suspension hours for the service in a week, starting from Monday 00:00. If an hour is set to true, the service checks will be suspended in this hour.
An array of booleans.
This array has to contain exactly 168 elements.
Defaults to an array containing 168 "0"
elements if not specified.
The service's identifier.
Permanently deletes a service with all settings and gathered statistics.
The service's identifier.
Nothing.
This method allows you to fetch information about selected Service objects.
Filters to apply to the results.
An array of objects, each containg the fields:
The filter argument (the text to be contained in the field, or value to be compared). The argument must be of the same type as the field you filter by.
The field to filter the results by.
Allowed values are: avg_response_time
, description
, error
, group_id
, id
, interval
, last_invalid_check
, last_valid_check
, name
, pause
, silent_mode
, suspension
, type_id
, type_name
, url
.
The type of filter. Filters (not_)greater_than and (not_)lower_than compare numbers numerically and string lexicographically. Defaults to "equals".
Allowed values are: contains
, equals
, greater_than
, lower_than
, not_greater_than
, not_lower_than
.
Maximum array length: 10.
Items per page. If not specified, NULL or 0, all elements will be fetched. You should probably specify results ordering as well, if you want the results to be consistent.
The index of the first element to show on page. Items are numbered starting from 0. Default is 0. Only meaningful if limit
is specified as well.
Fields to order the results by, starting from the most significant.
An array of objects, each containg the fields:
The ordering direction, "ascending" or "descending".
Allowed values are: ascending
, descending
.
Defaults to "ascending"
if not specified.
The field to order by. If not specified, the results can be returned in any order.
Allowed values are: avg_response_time
, description
, error
, group_id
, id
, interval
, last_invalid_check
, last_valid_check
, name
, pause
, silent_mode
, suspension
, type_id
, type_name
, url
.
Maximum array length: 10.
The groups of fields to be returned with each object.
An array of strings.
Allowed values are: status
.
This array cannot contain duplicate values.
Defaults to []
if not specified.
An array of objects, each containg the fields:
The average service response time from last check (average time returned by each monitoring station) in microseconds. If the service has never been checked yet, NULL.
The service description.
True if the service is in error state or has been in error state before it was paused. NULL if the service has never been checked yet.
The identifier of the group the service belongs to. If not specified upon creation, the service will be added to your default group.
The service's identifier.
The time interval between service checks, in seconds. Minimal available interval is limited by your package, see Package::Read to check your limit.
Allowed values are: 60, 120, 180, 300, 600, 900, 1200, 1800, 2700, 3600.
The Unix timestamp of the last service incorrect check or NULL if there weren't any incorrect checks yet.
The Unix timestamp of the last service correct check or NULL if there weren't any correct checks yet.
The service name.
True if the service is paused (not including the scheduled service suspensions).
True if the service notifications are suspended (due to the daily notification suspensions schedule).
The current service monitoring status.
You have to include status
in the with
argument to fetch this field.
Allowed values are: error
, ok
, paused
, suspended
, unknown
.
The current service monitoring status description.
You have to include status
in the with
argument to fetch this field.
True if the service checks are suspended (due to weekly schedule or a planned suspension).
The service type's identifier.
The service type's name.
The URL or IP address of the monitored service.
The total number of results (not including pagination).
This method can be called by read-only users.
Returns the JSON or WSDL specification of the Service
API module.
This method is meant for internal usage in API clients. Unless you are writing one, you probably do not need it.
The specification format you want to use. If omitted, defaults to json
if you call this method using JSON request ot wsdl
if you call this method with SOAP.
Allowed values are: json
, wsdl
.
The specification of the module.
The specification format used.
Allowed values are: json
, wsdl
.
This method can be called by read-only users.
Get information about one of your services.
The results may contain different fields depending on the with
argument. See each field's description below to find out which with
token is required.
The service's identifier.
The groups of fields to be returned with the object.
An array of strings.
Allowed values are: features
, notifications_config
, silent_mode_hours
, status
, suspension_hours
.
This array cannot contain duplicate values.
Defaults to []
if not specified.
The average service response time from last check (average time returned by each monitoring station) in microseconds. If the service has never been checked yet, NULL.
An array of 24 boolean values representing the silent mode setting for each day hour. If an hour is set to true, then no notifications for this service will be sent during this hour.
You have to include silent_mode_hours
in the with
argument to fetch this field.
An array of booleans.
This array has to contain exactly 24 elements.
The service description.
True if the service is in error state or has been in error state before it was paused. NULL if the service has never been checked yet.
Type-specific service features.
You have to include features
in the with
argument to fetch this field.
An array of objects, each containg the fields:
The feature ID
The feature value.
The identifier of the group the service belongs to. If not specified upon creation, the service will be added to your default group.
The service's identifier.
The time interval between service checks, in seconds. Minimal available interval is limited by your package, see Package::Read to check your limit.
Allowed values are: 60, 120, 180, 300, 600, 900, 1200, 1800, 2700, 3600.
The Unix timestamp of the last service incorrect check or NULL if there weren't any incorrect checks yet.
The Unix timestamp of the last service correct check or NULL if there weren't any correct checks yet.
An array containing results of the last check from each monitoring location.
You have to include status
in the with
argument to fetch this field.
An array of objects, each containg the fields:
The ID of the monitoring location.
The name of the monitoring location.
The type of result (correct check, error detected or the monitoring station failed to send the results).
Allowed values are: error
, ok
, unknown
.
The status text that can be displayed to the user. In case of an error it will contain the error message. Except for error messages, this text is affected by the API call language (the lang
parameter).
The service name.
Notification channels enabled for the service.
You have to include notifications_config
in the with
argument to fetch this field.
An array of strings.
Allowed values are: email_extended
, email_long
, email_short
, email_simplified
, gadu_gadu
, hipchat
, jabber
, json_post
, push
, sms
.
This array cannot contain duplicate values.
Notification conditions (types of events to notify about) for this service.
You have to include notifications_config
in the with
argument to fetch this field.
An array of strings.
Allowed values are: bad
, ok
, pause
, still_bad
, still_bad_after_silent_mode
.
This array cannot contain duplicate values.
The minimum time delay (in seconds) between subsequent "still not working" notifications for the service.
You have to include notifications_config
in the with
argument to fetch this field.
Minimum: 30
Maximum: 3600
The notifications mode for this service. This setting determines whether the notifications are being sent immediately after a service breakdown, after a certain period of the service not working, or are turned off entirely.
You have to include notifications_config
in the with
argument to fetch this field.
Allowed values are: after_10_minutes
, after_15_minutes
, after_1_minute
, after_30_minutes
, after_30_seconds
, after_5_minutes
, immediately
, off
.
True if the service is paused (not including the scheduled service suspensions).
True if the service notifications are suspended (due to the daily notification suspensions schedule).
The current service monitoring status.
You have to include status
in the with
argument to fetch this field.
Allowed values are: error
, ok
, paused
, suspended
, unknown
.
The current service monitoring status description.
You have to include status
in the with
argument to fetch this field.
True if the service checks are suspended (due to weekly schedule or a planned suspension).
The service type's identifier.
The service type's name.
The protocol-specific URL prefix. You must not specify the prefix in the service's URL, you can assume that this one will be used (when applicable).
The URL or IP address of the monitored service.
An array of suspension hours for the service in a week, starting from Monday 00:00. If an hour is set to true, the service checks will be suspended in this hour.
You have to include suspension_hours
in the with
argument to fetch this field.
An array of booleans.
This array has to contain exactly 168 elements.
This method can be called by read-only users.
Changes a service's settings.
A special case is enabling and disabling the monitoring - to do it, change the pause
attribute to 1
or 0
.
An array of 24 boolean values representing the silent mode setting for each day hour. If an hour is set to true, then no notifications for this service will be sent during this hour.
An array of booleans.
This array has to contain exactly 24 elements.
The service description.
Type-specific service features.
To list required features for a particular service type, use the ServiceType::Read method with features
.
If you want to delete a feature, specify the NULL as the value.
An array of objects, each containg the fields:
The feature ID
The feature value.
The identifier of the group the service belongs to. If not specified upon creation, the service will be added to your default group.
The service's identifier.
The time interval between service checks, in seconds. Minimal available interval is limited by your package, see Package::Read to check your limit.
Allowed values are: 60, 120, 180, 300, 600, 900, 1200, 1800, 2700, 3600.
The service name.
Notification channels enabled for the service.
An array of strings.
Allowed values are: email_extended
, email_long
, email_short
, email_simplified
, gadu_gadu
, hipchat
, jabber
, json_post
, push
, sms
.
This array cannot contain duplicate values.
Notification conditions (types of events to notify about) for this service.
An array of strings.
Allowed values are: bad
, ok
, pause
, still_bad
, still_bad_after_silent_mode
.
This array cannot contain duplicate values.
The minimum time delay (in seconds) between subsequent "still not working" notifications for the service.
Minimum: 30
Maximum: 3600
The notifications mode for this service. This setting determines whether the notifications are being sent immediately after a service breakdown, after a certain period of the service not working, or are turned off entirely.
Allowed values are: after_10_minutes
, after_15_minutes
, after_1_minute
, after_30_minutes
, after_30_seconds
, after_5_minutes
, immediately
, off
.
True if the service is paused (not including the scheduled service suspensions).
The URL or IP address of the monitored service.The URL should be specified without the URI scheme part (for example http://
). If such scheme is present, it will be removed from the URL.
An array of suspension hours for the service in a week, starting from Monday 00:00. If an hour is set to true, the service checks will be suspended in this hour.
An array of booleans.
This array has to contain exactly 168 elements.
Nothing.