Module netapp_ontap.resources.autosupport_message
Copyright © 2019 NetApp Inc. All rights reserved.
Overview
This API is used to invoke and retrieve AutoSupport messages from the nodes in the cluster.
This API supports POST and GET calls. A POST call is used to invoke AutoSupport and a GET call is used to retrieve AutoSupport messages.Examples
Invoking an AutoSupport on all nodes in the cluster
The following example invokes an AutoSupport on every node in the cluster.
Note that AutoSupport is invoked on all nodes in the cluster if the node
param is omitted. Also, note that the subject
line is the same when invoking on all nodes.
return_records=true
is passed in the request, the response includes information about the node and the index of the invoked AutoSupport message.
# The API:
POST /support/autosupport/messages
# The call:
curl -X POST "https://<mgmt-ip>/api/support/autosupport/messages?return_records=true" -H "accept: application/hal+json" -H "Content-Type: application/json" -d "{ \"message\": \"test_msg\", \"type\": \"all\"}"
# The response:
201 CREATED
{
"num_records": 2,
"records": [
{
"index": 4,
"node": {
"name": "node1",
"uuid": "092e0298-f250-11e8-9a05-005056bb6666",
"_links": {
"self": {
"href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
}
}
},
"_links": {
"self": {
"href": "/api/support/autosupport/messages/092e0298-f250-11e8-9a05-005056bb6666/4"
}
}
},
{
"index": 2,
"node": {
"name": "node2",
"uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
"_links": {
"self": {
"href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
}
}
},
"_links": {
"self": {
"href": "/api/support/autosupport/messages/e47d2630-f250-11e8-b186-005056bb5cab/2"
}
}
}
],
"_links": {
"self": {
"href": "/api/support/autosupport/messages/"
}
}
}
Invoking an AutoSupport on a single node
The following examples invoke an AutoSupport on a single node in the cluster.
Note that AutoSupport is invoked on all nodes in the cluster if the node
param is omitted. You can specify the node-name with either node
or node.name
parameter. You can also specify UUID of the node with the node.uuid
parameter.
return_records=true
is passed in the request, the response includes information about the node and the index of the invoked AutoSupport message.
# The API:
POST /support/autosupport/messages
# The call:
curl -X POST "https://<mgmt-ip>/api/support/autosupport/messages?return_records=true" -H "accept: application/hal+json" -H "Content-Type: application/json" -d "{ \"message\": \"test_msg\", \"type\": \"test\", \"node\":\"node1\"}"
# The response:
201 CREATED
{
"num_records": 1,
"records": [
{
"index": 8,
"node": {
"name": "node1",
"uuid": "092e0298-f250-11e8-9a05-005056bb6666",
"_links": {
"self": {
"href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
}
}
},
"_links": {
"self": {
"href": "/api/support/autosupport/messages/092e0298-f250-11e8-9a05-005056bb6666/8"
}
}
}
],
"_links": {
"self": {
"href": "/api/support/autosupport/messages/"
}
}
}
# The call:
curl -X POST "https://<mgmt-ip>/api/support/autosupport/messages?return_records=true" -H "accept: application/hal+json" -H "Content-Type: application/json" -d "{ \"message\": \"test_msg\", \"type\": \"test\", \"node.name\":\"node2\"}"
# The response:
201 CREATED
{
"num_records": 1,
"records": [
{
"index": 4,
"node": {
"name": "node2",
"uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
"_links": {
"self": {
"href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
}
}
},
"_links": {
"self": {
"href": "/api/support/autosupport/messages/e47d2630-f250-11e8-b186-005056bb5cab/4"
}
}
}
],
"_links": {
"self": {
"href": "/api/support/autosupport/messages/"
}
}
}
# The call:
curl -X POST "https://<mgmt-ip>/api/support/autosupport/messages?return_records=true" -H "accept: application/hal+json" -H "Content-Type: application/json" -d "{ \"message\": \"test_msg\", \"type\": \"test\", \"node.uuid\":\"092e0298-f250-11e8-9a05-005056bb6666\"}"
# The response:
201 CREATED
{
"num_records": 1,
"records": [
{
"index": 5,
"node": {
"name": "node1",
"uuid": "092e0298-f250-11e8-9a05-005056bb6666",
"_links": {
"self": {
"href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
}
}
},
"_links": {
"self": {
"href": "/api/support/autosupport/messages/092e0298-f250-11e8-9a05-005056bb6666/5"
}
}
}
],
"_links": {
"self": {
"href": "/api/support/autosupport/messages/"
}
}
}
Retrieving AutoSupport messages from all nodes in the cluster
The following example retrieves AutoSupport messages from every node in the cluster. Note that if the fields=* parameter is not specified, only node, index, and destination fields are returned. Filters can be added on the fields to limit the results.
# The API:
GET /support/autosupport/messages
# The call:
curl -X GET "https://<mgmt-ip>/api/support/autosupport/messages?fields=*&return_timeout=15" -H "accept: application/hal+json"
# The response:
200 OK
{
"records": [
{
"node": {
"uuid": "092e0298-f250-11e8-9a05-005056bb6666",
"name": "node1",
"_links": {
"self": {
"href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
}
}
},
"index": 1,
"destination": "smtp",
"subject": "USER_TRIGGERED (TEST:test_msg)",
"state": "ignore",
"generated_on": "2019-03-28T10:18:04-04:00",
"_links": {
"self": {
"href": "/api/support/autosupport/messages/092e0298-f250-11e8-9a05-005056bb6666/1/smtp"
}
}
},
{
"node": {
"uuid": "092e0298-f250-11e8-9a05-005056bb6666",
"name": "node1",
"_links": {
"self": {
"href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
}
}
},
"index": 1,
"destination": "http",
"subject": "USER_TRIGGERED (TEST:test_msg)",
"state": "sent_successful",
"generated_on": "2019-03-28T10:18:04-04:00",
"_links": {
"self": {
"href": "/api/support/autosupport/messages/092e0298-f250-11e8-9a05-005056bb6666/1/http"
}
}
},
{
"node": {
"uuid": "092e0298-f250-11e8-9a05-005056bb6666",
"name": "node1",
"_links": {
"self": {
"href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
}
}
},
"index": 1,
"destination": "noteto",
"subject": "USER_TRIGGERED (TEST:test_msg)",
"state": "ignore",
"generated_on": "2019-03-28T10:18:04-04:00",
"_links": {
"self": {
"href": "/api/support/autosupport/messages/092e0298-f250-11e8-9a05-005056bb6666/1/noteto"
}
}
},
{
"node": {
"uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
"name": "node2",
"_links": {
"self": {
"href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
}
}
},
"index": 1,
"destination": "smtp",
"subject": "USER_TRIGGERED (TEST:test_msg)",
"state": "ignore",
"generated_on": "2019-03-28T10:18:06-04:00",
"_links": {
"self": {
"href": "/api/support/autosupport/messages/e47d2630-f250-11e8-b186-005056bb5cab/1/smtp"
}
}
},
{
"node": {
"uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
"name": "node2",
"_links": {
"self": {
"href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
}
}
},
"index": 1,
"destination": "http",
"subject": "USER_TRIGGERED (TEST:test_msg)",
"state": "sent_successful",
"generated_on": "2019-03-28T10:18:06-04:00",
"_links": {
"self": {
"href": "/api/support/autosupport/messages/e47d2630-f250-11e8-b186-005056bb5cab/1/http"
}
}
},
{
"node": {
"uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
"name": "node2",
"_links": {
"self": {
"href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
}
}
},
"index": 1,
"destination": "noteto",
"subject": "USER_TRIGGERED (TEST:test_msg)",
"state": "ignore",
"generated_on": "2019-03-28T10:18:06-04:00",
"_links": {
"self": {
"href": "/api/support/autosupport/messages/e47d2630-f250-11e8-b186-005056bb5cab/1/noteto"
}
}
}
],
"num_records": 6,
"_links": {
"self": {
"href": "/api/support/autosupport/messages?fields=*&return_timeout=15"
}
}
}
Retrieving AutoSupport messages from a specific node and has 'sent_succesful' state
The following example retrieves AutoSupport messages from a specific node in the cluster.
Note that if the fields=*
parameter is not specified, only node, index, and destination fields are returned.
This example uses a filter on the node.name
and state
fields. Similar to this, filters can be added to any fields in the response.
# The API:
GET /support/autosupport/messages
# The call:
curl -X GET "https://<mgmt-ip>/api/support/autosupport/messages?node.name=node1&state=sent_successful&fields=*&return_timeout=15" -H "accept: application/hal+json"
# The response:
200 OK
{
"records": [
{
"node": {
"uuid": "092e0298-f250-11e8-9a05-005056bb6666",
"name": "node1",
"_links": {
"self": {
"href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
}
}
},
"index": 1,
"destination": "http",
"subject": "USER_TRIGGERED (TEST:test_msg)",
"state": "sent_successful",
"generated_on": "2019-03-28T10:18:04-04:00",
"_links": {
"self": {
"href": "/api/support/autosupport/messages/092e0298-f250-11e8-9a05-005056bb6666/1/http"
}
}
}
],
"num_records": 1,
"_links": {
"self": {
"href": "/api/support/autosupport/messages?node.name=node1&state=sent_successful&fields=*&return_timeout=15"
}
}
}
Classes
class AutosupportMessage (*args, **kwargs)
-
Allows interaction with AutosupportMessage objects on the host
Initialize the instance of the resource.
Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:
MyResource(name='foo').name == 'foo'
Args
*args
- Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
**kwargs
- each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.
Ancestors
Static methods
def find(*args, connection: HostConnection = None, **kwargs) -> Resource
-
Retrieves AutoSupport message history from all nodes in the cluster.
There can be a short delay on invoked AutoSupport messages showing in history, dependent on processing of other AutoSupports in the queue.Related ONTAP commands
system node autosupport history show
Learn more
Find an instance of an object on the host given a query.
The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found or if more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.
Args
*args
- Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
connection
- The
HostConnection
object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context. **kwargs
- Any key/value pairs passed will be sent as query parameters to the host.
Returns
A
Resource
object containing the details of the object.Raises
NetAppRestError
: If the API call did not return exactly 1 matching resource. def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> typing.Iterable
-
Retrieves AutoSupport message history from all nodes in the cluster.
There can be a short delay on invoked AutoSupport messages showing in history, dependent on processing of other AutoSupports in the queue.Related ONTAP commands
system node autosupport history show
Learn more
Fetch a list of all objects of this type from the host.
Args
*args
- Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
connection
- The
HostConnection
object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context. max_records
- The maximum number of records to return per call
**kwargs
- Any key/value pairs passed will be sent as query parameters to the host.
Returns
A list of
Resource
objectsRaises
NetAppRestError
: If there is no connection available to use either passed in or on the library.
Methods
def post(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse
-
Generates and sends an AutoSupport message with the provided input parameters.
Important note: * By default, the response is an empty object. Ifreturn_records=true
is passed in the request, the response includes information about the node and the index of the invoked AutoSupport message.Recommended optional properties
message
- Message included in the AutoSupport subject. Use to identify the generated AutoSupport message.
Default property values
If not specified in POST, the following default property values are assigned: *
type
- all *node.name
ornode.uuid
- Not specifying any of these properties invokes the AutoSupport on all nodes in the cluster.Related ONTAP commands
system node autosupport invoke
Learn more
Send this object to the host as a creation request.
Args
hydrate
- If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
poll
- If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
- If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
- If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
**kwargs
- Any key/value pairs passed will be sent as query parameters to the host.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400
Inherited members
class AutosupportMessageSchema (only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
-
The fields of the AutosupportMessage object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.schema.BaseSchema
- marshmallow.base.SchemaABC
Class variables
var destination
-
Destination for the AutoSupport
Valid choices:
- smtp
- http
- noteto
- retransmit
var error
-
The error field of the autosupport_message.
var generated_on
-
Date and Time of AutoSupport generation in ISO-8601 format
Example: 2019-03-25T21:30:04.000+0000
var index
-
Sequence number of the AutoSupport
Example: 9
var message
-
Message included in the AutoSupport subject
Example: invoked_test_autosupport_rest
var node
-
The node field of the autosupport_message.
var opts
var state
-
State of AutoSupport delivery
Valid choices:
- initializing
- collection_failed
- collection_in_progress
- queued
- transmitting
- sent_successful
- ignore
- re_queued
- transmission_failed
- ondemand_ignore
- cancelled
var subject
-
Subject line for the AutoSupport
Example: WEEKLY_LOG
var type
-
Type of AutoSupport collection to issue
Valid choices:
- test
- performance
- all
var uri
-
Alternate destination for the AutoSupport
Example: http://1.2.3.4/delivery_uri