Monitoring/Memory

From Hostway API Documentation
Revision as of 13:36, 30 May 2016 by Corinne.chui (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

POST /accounts/account_number/dedicatedServers/dedicated_server/ipAddresses/ip_address/monitoring/memory

This API call is deprecated!

Create Memory check

Parameters

account - string
dedicated_server - string
ip_address - string

Request

JSON

{
   "monitoring": {
      "check": {
            "enabled": {enabled}, 
            "enabledAlert": {enabled_alert}
         }, 
      "options": {
         "freeMemory": 1024,
         "freeSwap": 2048 
      }
   }
}

monitoring

check
check.enabled - boolean
Enable the check
check.enabledAlert - boolean
Enable alerts
options
options.freeMemory - int
The memory usage limit for check alerts
options.freeSwap - int
The swap file usage limit for check alerts

Response

JSON

{
   "monitoring": {
      "type": "memory", 
      "options": {
         "freeMemory": 1024,
         "freeSwap": 2048 
      }, 
      "check": {
         "status": {status}, 
         "lastCheck": {last_check}, 
         "enabledAlert": {enabled_alert}, 
         "enabled": {enabled}, 
         "id": {id}
      }
   }, 
   "links": [
      {
         "href": "http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/{id}", "rel": "self"
      }
   ]
}

monitoring

type - string
memory
links - list
Hypermedia for this resource.
check
check.id - string
Unique identifier for this check.
check.status
Status of the memory check
check.lastCheck
Time of last memory check
check.enabled - boolean
Is the check enabled
check.enabledAlert - boolean
Are alerts enabled
options
options.freeMemory - int
The memory usage limit for check alerts
options.freeSwap - int
The swap file usage limit for check alerts


Response Codes

Success
HTTP/1.1 201 Created
Failure
HTTP/1.1 400 Bad Request: There was an error in the request the client sent
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 403 Forbidden : You don't have permissions to access the resource
HTTP/1.1 404 Not Found : The resource requested is not found.
HTTP/1.1 409 Conflict : Only one memory check for Dedicated Server per IP is allowed

Examples

Successfully create a memory check

POST http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory

Request:

{"monitoring": {"check": {"enabled": false, "enabledAlert": false}, "options": {"freeMemory": 1024, "freeSwap": 1024}}}

Response Code:

HTTP/1.1 201 Created

Response Body:

{
   "monitoring": {
      "type": "memory", 
      "options": {
         "freeMemory": 1024,
         "freeSwap": 1024 
      }, 
      "check": {
         "status": null, 
         "lastCheck": null, 
         "enabledAlert": false, 
         "enabled": true, 
         "id": 16
      }
   }, 
   "links": [
      {
         "href": "http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/16", "rel": "self"
      }
   ]
}


Bad request - missing options in the request body

POST http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory

Request:

{"monitoring": {"check": {"enabled": false, "enabledAlert": false}}}

Response Code:

HTTP/1.1 400 Bad Request

Response Body:

{"badRequest": {"message": "POST data error", "code": 400, "details": {"monitoring.options": "Required"}}}


Request to create memory check for a missing dedicated server or IP address

POST http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{fake_server}/ipAddresses/{ip_address}/monitoring/memory
POST http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{fake_ip}/monitoring/memory

Request:

{"monitoring": {"check": {"enabled": true, "enabledAlert": false}, "options": {"freeMemory": 1024, "freeSwap": 1024}}}

Response Code:

HTTP/1.1 404 Not Found


Add an existing memory check

POST http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory

Request:

{"monitoring": {"check": {"enabled": true, "enabledAlert": false}, "options": {"freeMemory": 1024, "freeSwap": 1024}}}

Response Code:

HTTP/1.1 409 Conflict


GET /accounts/account/dedicatedServers/dedicated_server/ipAddresses/ip_address/monitoring/memory/id

This API call is deprecated!

Get memory check details

Parameters

account - string
dedicated_server - string
ip_address - string
id - string
Id of the memory check.

Response

JSON

{
   "monitoring": {
      "type": "{type}", 
      "options": {
         "freeMemory": 1024,
         "freeSwap": 2048 
      },
      "check": {
         "status": {status}, 
         "lastCheck": {last_check}, 
         "enabledAlert": {enabled_alert}, 
         "enabled": {enabled}, 
         "id": {id}
      }
   }, 
   "links": [
      {
         "href": "http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/{id}", "rel": "self"
      }
   ]
}

monitoring

type - string
memory
links - list
Hypermedia for this resource.
check
check.id - string
Unique identifier for this check.
check.status
Status of the memory check
check.lastCheck
Time of last memory check
check.enabled - boolean
Is the check enabled
check.enabledAlert - boolean
Are alerts enabled
options
options.freeMemory - int
The memory usage limit for check alerts
options.freeSwap - int
The swap file usage limit for check alerts


Response Codes

Success
HTTP/1.1 200 Ok
Failure
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 403 Forbidden : You don't have permissions to access the resource
HTTP/1.1 404 Not Found : The resource requested is not found.


Examples

View memory check details

GET http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/16

Response Code:

HTTP/1.1 200 Ok

Response Body:

{
   "monitoring": {
      "type": "memory", 
      "options": {
         "freeMemory": 1024,
         "freeSwap": 1024 
      }, 
      "check": {
         "status": null, 
         "lastCheck": null, 
         "enabledAlert": false, 
         "enabled": true, 
         "id": 16
      }
   }, 
   "links": [
      {
         "href": "http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/16", "rel": "self"
      }
   ]
}

Access a non-existing memory check

GET http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/9999

Response Code:

HTTP/1.1 404 Not Found

Request a check for missing server or IP addresss

GET http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{fake_server}/ipAddresses/{ip_address}/monitoring/memory/16
GET http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{fake_ip}/monitoring/memory/16

Response Code:

HTTP/1.1 404 Not Found


PUT /accounts/account/dedicatedServers/dedicated_server/ipAddresses/ip_address/monitoring/memory/id

This API call is deprecated!

Update memory check

Parameters

account - string
dedicated_server - string
ip_address - string
id - string
Id of the memory check.

Request

JSON

{
   "monitoring": {
      "check": {
            "enabled": {enabled}, 
            "enabledAlert": {enabled_alert}
         }, 
      "options": {
         "freeMemory": 1024,
         "freeSwap": 2048 
      },
   }
}

monitoring

check
check.enabled - boolean
Enable the check
check.enabledAlert - boolean
Enable alerts
options
options.freeMemory - int
The memory usage limit for check alerts
options.freeSwap - int
The swap file usage limit for check alerts


Response

JSON

{
   "monitoring": {
      "type": "{type}", 
      "options": {
         "freeMemory": 1024,
         "freeSwap": 2048 
      },
      "check": {
         "status": {status}, 
         "lastCheck": {last_check}, 
         "enabledAlert": {enabled_alert}, 
         "enabled": {enabled}, 
         "id": {id}
      }
   }, 
   "links": [
      {
         "href": "http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/{id}", "rel": "self"
      }
   ]
}

monitoring

type - string
memory
links - list
Hypermedia for this resource.
check
check.id - string
Unique identifier for this check.
check.status
Status of the memory check
check.lastCheck
Time of last memory check
check.enabled - boolean
Is the check enabled
check.enabledAlert - boolean
Are alerts enabled
options
options.freeMemory - int
The memory usage limit for check alerts
options.freeSwap - int
The swap file usage limit for check alerts


Response Codes

Success
HTTP/1.1 200 Ok
Failure
HTTP/1.1 400 Bad Request
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 403 Forbidden
HTTP/1.1 404 Not Found : The resource requested is not found.


Examples

Update existing memory check'

PUT http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/16

Request:

{"monitoring": {"check": {"enabled": true, "enabledAlert": false}, "options": {"freeMemory": 2048, "freeSwap": 2048}}}

Response Code:

HTTP/1.1 200 Ok

Response Body:

{
   "monitoring": {
      "type": "memory", 
      "options": {
         "freeMemory": 2048,
         "freeSwap": 2048 
      }, 
      "check": {
         "status": ERROR, 
         "lastCheck": 1334148166, 
         "enabledAlert": false, 
         "enabled": true, 
         "id": 16
      }
   }, 
   "links": [
      {
         "href": "http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/16", "rel": "self"
      }
   ]
}

Bad request - update a memory check with wrong request data

PUT http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/16

Request:

{"monitoring": {"options": {"freeMemory": 1024, "freeSwap": 1024}}}

Response Code:

HTTP/1.1 400 Bad Request

Response Body:

{"badRequest": {"message": "POST data error", "code": 400, "details": {"monitoring.check": "Required"}}}


Try to update a missing memory check resource

PUT http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/9999

Request:

{"monitoring": {"check": {"enabled": true, "enabledAlert": false}, "options": {"freeMemory": 1024, "freeSwap": 1024}}}

Response Code:

HTTP/1.1 404 Not Found


DELETE /accounts/account/dedicatedServers/dedicated_server/ipAddresses/ip_address/monitoring/memory/id

This API call is deprecated!

Delete memory check

Parameters

account - string
dedicated_server - string
ip_address - string
id - string
Id of the memory check.

Response Codes

Success deleting the resource
HTTP/1.1 204 No Content
Failure
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 403 Forbidden
HTTP/1.1 404 Not Found : The resource requested is not found.


Examples

Successfully delete a memory check

DELETE http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/16

Response Code:

HTTP/1.1 204 No Content


Request to delete a missing memory check resource

DELETE http(s)://{api_server}/accounts/{account_number}/dedicatedServers/{dedicated_server}/ipAddresses/{ip_address}/monitoring/memory/9999

Response Code:

HTTP/1.1 404 Not Found
Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox