opennms_client package¶
Submodules¶
opennms_client.exceptions module¶
opennms_client.exceptions¶
This module contains the set of client’s exceptions.
-
exception
opennms_client.exceptions.MoreThanOneIpInterfaceReturnedError(code=None, reason=None, string=None)¶ Bases:
opennms_client.exceptions.OpenNMSClientErrorMore than one ip interface was returned when only principal was requested.
-
exception
opennms_client.exceptions.MoreThanOneNodeReturnedError(code=None, reason=None, string=None)¶ Bases:
opennms_client.exceptions.OpenNMSClientErrorMore than one node was returned with query supplied.
-
exception
opennms_client.exceptions.NodeDoesNotExistError(code=None, reason=None, string=None)¶ Bases:
opennms_client.exceptions.OpenNMSClientErrorNode does not exist.
-
exception
opennms_client.exceptions.OpenNMSClientConnectError(code=None, reason=None, string=None)¶ Bases:
opennms_client.exceptions.OpenNMSClientErrorCan Not Connect to openNMS server
-
exception
opennms_client.exceptions.OpenNMSClientError(code=None, reason=None, string=None)¶ Bases:
exceptions.RuntimeErrorThere was an ambiguous exception that occurred while handling your request.
-
exception
opennms_client.exceptions.ServiceDoesNotExistError(code=None, reason=None, string=None)¶ Bases:
opennms_client.exceptions.OpenNMSClientErrorService does not exist.
-
exception
opennms_client.exceptions.ServiceDoesNotExistInNodeError(code=None, reason=None, string=None)¶ Bases:
opennms_client.exceptions.OpenNMSClientErrorService does not exist in the node provided.
-
exception
opennms_client.exceptions.UnknownError(code=None, reason=None, string=None)¶ Bases:
opennms_client.exceptions.OpenNMSClientErrorUnknown error, please report full log at https://github.com/mvillarejo/opennms_client/issues
opennms_client.log module¶
opennms_client.opennms_client module¶
opennms_client.opennms_client¶
This module implements client connection with OpenNMS servers
-
class
opennms_client.opennms_client.OpenNMSClient(url, user, password, debug=False)¶ Bases:
object-
alarms(limit=10)¶ Alarms.
-
delete_node(hostname)¶ Delete node details using REST interface
Parameters: hostname (str) – hostname Returns: dict – response Raises:
-
delete_node_service(hostname, service_name)¶ Delete a service of a node
Parameters: - hostname (str) –
- service_name (str) –
Returns: dict
Raises: ServiceDoesNotExistInNodeError
-
disconnect()¶ close session.
-
get_node(hostname)¶ Return node details using REST interface :param hostname: hostname :type hostname: str :return: dict – node details :raises: MoreThanOneNodeReturnedError, NodeDoesNotExistError
-
get_node_ipinterface_principal(hostname)¶ Returns node principal interface :param hostname: :return:
-
get_node_ipinterfaces(hostname, principal=False)¶ Returns a list of interfaces give a hostname/node_id :param hostname: Hostname of the host to get interfaces from :param principal: return a single interface, the primary :return:
-
get_node_services(hostname)¶ Get node services
Parameters: hostname (str) – Returns: dict
-
get_node_services_list(hostname)¶ Get node services names in a list
Parameters: hostname (str) – Returns: list
-
get_nodes(limit=10)¶ Return a list of nodes using REST interface :param limit: amount of nodes :type limit: int :return: dict – dictionary of nodes
-
get_services()¶ Return a list of services using WEB interface :param limit: amount of services :return: dictionary of services { ‘name’: id, ... }
-
healthcheck()¶ healthcheck.
-
set_node_service(hostname, service_name, index=0)¶ Add a service to a node from it’s hostname
Parameters: - hostname –
- service_name –
- index –
Returns: Raises: ServiceDoesNotExistError
-
opennms_client.templates module¶
opennms_client.templates¶
This file contains xml templates needed by client
opennms_client.urls module¶
opennms_client.urls¶
This file contains mappings between methods and urls