Module netapp_ontap.resources.ems_application_log

Copyright © 2023 NetApp Inc. All rights reserved.

This file has been automatically generated based on the ONTAP REST API documentation.

Overview

A POST request allows a standalone application to log its events on the ONTAP system as EMS events and optionally generate AutoSupports. This event information is encapsulated in an app.log.x event, or callhome.client.app.x event in case AutoSupport generation is required, based on the event's severity.

Note: This API only supports POST. Generated events can be retrieved using the /api/support/ems/events API.

Examples

Creating a new app.log.* event

The following example generates an app.log.error event.

from netapp_ontap import HostConnection
from netapp_ontap.resources import EmsApplicationLog

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = EmsApplicationLog()
    resource.computer_name = "W12-R2-DC"
    resource.event_source = "SnapCenter Software"
    resource.app_version = "3.0.0.2373"
    resource.event_id = 10001
    resource.category = "error"
    resource.event_description = "Clone split job failed"
    resource.severity = "error"
    resource.autosupport_required = False
    resource.post(hydrate=True)
    print(resource)


Retrieving a list of events generated by this API

The following example retrieves all app.log.* events.

from netapp_ontap import HostConnection
from netapp_ontap.resources import EmsEvent

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(list(EmsEvent.get_collection(**{"message.name": "app.log.*"})))

[
    EmsEvent(
        {
            "index": 7865,
            "log_message": "app.log.emerg: iMac: iPad ipad3: (10001) handheld: TestLine1",
            "time": "2021-09-17T09:36:28-04:00",
            "_links": {"self": {"href": "/api/support/ems/events/node1/7865"}},
            "node": {
                "name": "node1",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/d96d5d8d-118a-11ec-aad8-005056bb974c"
                    }
                },
                "uuid": "d96d5d8d-118a-11ec-aad8-005056bb974c",
            },
            "message": {"severity": "emergency", "name": "app.log.emerg"},
        }
    )
]

Classes

class EmsApplicationLog (*args, **kwargs)

Input for generation of app.log.x and callhome.client.app.x events.

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 post_collection (records: Iterable[_ForwardRef('EmsApplicationLog')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[EmsApplicationLog], NetAppResponse]

Creates an app.log. event. Setting the "autosupport_required" flag causes callhome.client.app. events also to be generated, which in turn triggers AutoSupports.

Required properties

  • computer_name - Client computer connected to the cluster.
  • event_source - Client application that generated this event.
  • app_version - Client application version.
  • event_id - Application eventID.
  • category - Event category.
  • event_description - Event description.
  • severity - Severity of the event.
  • autosupport_required - Indicates whether AutoSupport generation is required.

Learn more


Send this collection of objects to the host as a creation request.

Args

records
A list of Resource objects to send to the server to be created.
*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 create a bar for a particular foo, the foo.name value should be passed.
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 each object. When hydrate is set to True, poll must also be set to True.
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.
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. Only resources matching this query will be patched.

Returns

A list of Resource objects matching the provided type which have been created by the host and returned. This is not the same list that was provided, so to continue using the object, you should save this list. If poll is set to False, then a NetAppResponse object is returned instead.

Raises

NetAppRestError: If the API call returned a status code >= 400

Methods

def post (self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse

Creates an app.log. event. Setting the "autosupport_required" flag causes callhome.client.app. events also to be generated, which in turn triggers AutoSupports.

Required properties

  • computer_name - Client computer connected to the cluster.
  • event_source - Client application that generated this event.
  • app_version - Client application version.
  • event_id - Application eventID.
  • category - Event category.
  • event_description - Event description.
  • severity - Severity of the event.
  • autosupport_required - Indicates whether AutoSupport generation is required.

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.
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 normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

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 EmsApplicationLogSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)

The fields of the EmsApplicationLog object

Ancestors

  • netapp_ontap.resource.ResourceSchema
  • marshmallow.schema.Schema
  • marshmallow.base.SchemaABC

Class variables

app_version: str POST

Client application version.

Example: 3.0.0.2373

autosupport_required: bool POST

Indicates whether AutoSupport generation is required.

Example: false

category: str POST

Event category.

Example: Error

computer_name: str POST

Client computer connected to the cluster.

Example: W12-R2-DC

event_description: str POST

Event description, which corresponds to the subject parameter in the generated event.

Example: Clone split job failed

event_id: Size POST

Application eventID.

Example: 10001

event_source: str POST

Client application that generated this event.

Example: SnapCenter Software

severity: str POST

Severity

Valid choices:

  • emergency
  • alert
  • error
  • notice