jnpr.healthbot.modules

administration

devices

class jnpr.healthbot.modules.devices.Device(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
add(device_id: str = None, host: str = None, username: str = None, password: str = None, schema: jnpr.healthbot.swagger.models.device_schema.DeviceSchema = None, **kwargs)[source]

Add device to HealthBot

Parameters:
  • device_id (str) – The name of the device as provided by the User
  • host (str) – The hostname/ip-address of the target device
  • username (str) – The login user-name for the target device
  • password (str) – The login password for the user
  • schema (object) – DeviceSchema

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import DeviceSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    ds = DeviceSchema(device_id='xyz', host='xx.xxx.xxx.xxx',
          authentication={"password": {"password": "xxxxx", "username": "xxxxx"}})

    # we can also later assign values like this
    ds.description = "HbEZ testing"

    # This will add device in candidate DB
    hb.device.add(schema=ds)

    # commit changes to master DB
    hb.commit()
delete(device_id: str, force: bool = False)[source]

Remove device from HealthBot

Parameters:
  • device_id (str) – The name of the device as provided by the User
  • force (bool) – If True, Delete given device from all the device group (if present)

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    # This will delete device in candidate DB
    hb.device.delete('xyz')

    # commit changes to master DB
    hb.commit()
Returns:True when OK
get_ids()[source]

Return Device IDs for all the devices in HealthBot system

Returns:list of device IDs

Example:

from jnpr.healthbot import HealthBotClient
with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.device.get_ids())
get(device_id: str = None, uncommitted: bool = True)[source]

Get DeviceSchema for given device id or list for all devices

Parameters:
  • device_id (str) – The name of the device as provided by the User
  • uncommitted (bool) – True includes fetches uncommitted changes,

False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    device = hb.device.get('vmx')
    print(device)

    devices = hb.device.get()
    for device in devices:
        print(device)
Returns:DeviceSchema(s)
update(schema: jnpr.healthbot.swagger.models.device_schema.DeviceSchema = None, **kwargs)[source]

Update DeviceSchema for given device schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    DeviceSchema

  • kwargs (object) –

    key values, which can be used to create DeviceSchema Check DeviceSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.device.get('xyz')
    schemaObj.description = 'changed description'
    hb.device.update(schemaObj)

    hb.device.update(device_id="xyz", host='xx.xxx.x.xx', system_id="xxxx")
Returns:True when OK
get_facts(device_id: str = None, uncommitted: bool = True)[source]

Get device(s) facts. Get facts for provided device id, if device id is not provided, get facts for all devices

Parameters:
  • device_id (str) – The name of the device as provided by the User
  • uncommitted (bool) – True includes fetches uncommitted changes,

False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient
from pprint import pprint

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    facts = hb.device.get_facts('vmx')
    pprint(facts)
    facts = hb.device.get_facts()
    pprint(facts)
Returns:Single/List of dicts of facts
health(device_id: str)[source]

Returns health of given Device id DeviceHealthTree

Parameters:device_id (str) – The name of the device as provided by the User

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.device.health('core'))
Returns:DeviceHealthTree
class jnpr.healthbot.modules.devices.DeviceGroup(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
add(schema: jnpr.healthbot.swagger.models.device_group_schema.DeviceGroupSchema = None, **kwargs)[source]

Add device group to HealthBot

Parameters:
  • schema (object) – DeviceGroupSchema
  • kwargs (object) –

    key values, which can be used to create DeviceGroupSchema Check DeviceGroupSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import DeviceSchema
from jnpr.healthbot import DeviceGroupSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    ds = DeviceSchema(device_id='xyz', host='xx.xxx.xxx.xxx',
          authentication={"password": {"password": "xxxxx", "username": "xxxxx"}})

    # This will add device in candidate DB
    hb.device.add(schema=ds)

    dgs = DeviceGroupSchema(device_group_name="edge",
                                    description="All devices on the edge",
                                    devices=['xyz'])
    hb.device_group.add(dgs)

    # commit changes to master DB
    hb.commit()
Returns:True when OK
delete(device_group_name: str, force: bool = False)[source]

Remove device group to HealthBot

Parameters:
  • device_group_name (str) – The name of the device group to be deleted
  • force (bool) – If True, First delete services for given device group

Example:

hb.devices.delete('edge')
hb.commit()
Returns:True when OK
get(device_group_name: str = None, uncommitted: bool = True)[source]

Get DeviceGroupSchema for given device group name or list for all device groups

Parameters:
  • device_group_name (str) – Name of the device-group
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

device_group_schema = hb.device_group.get('edge')

groups = hb.device_group.get()
for group in groups:
    print(group)
Returns:DeviceGroupSchema(s)
update(schema: jnpr.healthbot.swagger.models.device_group_schema.DeviceGroupSchema = None, **kwargs)[source]

Update DeviceGroupSchema for given device schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    DeviceGroupSchema

  • kwargs (object) –

    key values, which can be used to create DeviceGroupSchema Check DeviceGroupSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.device_group.get('Core')
    schemaObj.description = "Changed"
    hb.device_group.update(schemaObj)
Returns:True when OK
check_device_in_group(device_name: str, device_group_name: str)[source]

This method check if the device is a member of the given device-group

Parameters:
  • device_name (str) – Name of the device
  • device_group_name (str) – Name of the device-group

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.device_group.check_device_in_group('vmx', 'QFabric'))
Returns:
True if action successful
add_device_in_group(device_name: str, device_group_name: str)[source]

This method ensures that the given device is a member of the given device-group

Parameters:
  • device_name (str) – Name of the device
  • device_group_name (str) – Name of the device-group

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    hb.device_group.add_device_in_group('vmx', 'QFabric')
Raises:
HTTPError: When error making changes via the HBOT API
Returns:
True if action successful
health(device_group_name: str)[source]

Returns health of given Device id DeviceGroupHealthTree

Parameters:device_group_name (str) – The name of the device group

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.device_group.health('edge'))
Returns:DeviceGroupHealthTree
class jnpr.healthbot.modules.devices.NetworkGroup(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
add(schema: jnpr.healthbot.swagger.models.network_group_schema.NetworkGroupSchema = None, **kwargs)[source]

Create Network Group

Parameters:
  • schema (object) – NetworkGroupSchema
  • kwargs (object) –

    key values, which can be used to create NetworkGroupSchema Check NetworkGroupSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    hb.devices.add_network_group(network_group_name="HbEZ")

# or
from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import NetworkGroupSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    ngs = NetworkGroupSchema(network_group_name="HbEZ")
    hb.network_group.add(schema = ngs)
delete(network_group_name: str)[source]

Delete Network Group

Parameters:network_group_name (str) – The name of the network group to be deleted

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    hb.network_group.delete(network_group_name="HbEZ")
get(network_group_name: str = None, uncommitted: bool = True)[source]

get Network Group(s) details

Parameters:
  • network_group_name (str) – The name of the network group to be fetched
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.network_group.get(network_group_name="HbEZ"))
    # for all network groups
    print(hb.network_group.get())
update(schema: jnpr.healthbot.swagger.models.network_group_schema.NetworkGroupSchema = None, **kwargs)[source]

Update NetworkGroupSchema for given network schema object

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    NetworkGroupSchema

  • kwargs (object) – key values, which can be used to create NetworkGroupSchema.

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.network_group.get("HbEZ")
    schemaObj.description = "HbEZ example"
    hb.network_group.update(schemaObj)
Returns:True when OK
health(network_group_name: str)[source]

Returns health of given Device id NetworkHealthTree

Parameters:network_group_name (str) – The name of the network group

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.network_group.health('core'))
Returns:NetworkHealthTree

rule

class jnpr.healthbot.modules.rules.Rule(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
add(topic_name: str, schema: jnpr.healthbot.swagger.models.rule_schema.RuleSchema = None, **kwargs)[source]

Create Rule under given topic

Parameters:
  • topic_name (str) – Rules to be created under this given topic name
  • schema (object) – RuleSchema
  • kwargs (object) –

    key values, which can be used to create RuleSchema Check RuleSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import RuleSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    rs = RuleSchema(rule_name="hbez-fpc-heap-utilization")

    rs.description = "HealthBot EZ example"
    rs.synopsis = "Using python client for demo"


    rs.sensor = [{'description': 'Monitors FPC buffer, heap and cpu utilization',
                  'iAgent': {'file': 'fpc-utilization.yml',
                             'frequency': '30s',
                             'table': 'FPCCPUHEAPutilizationTable'},
                  'sensor-name': 'fpccpuheaputilization'}]

    from jnpr.healthbot.swagger.models.rule_schema_field import RuleSchemaField
    from jnpr.healthbot.swagger.models.rule_schema_constant import RuleSchemaConstant

    rs.field = [RuleSchemaField(constant=RuleSchemaConstant(value='{{fpc-buffer-usage-threshold}}'),
                                description='This field is for buffer usage threshold',
                                field_name='linecard-buffer-usage-threshold'),
                RuleSchemaField(constant=RuleSchemaConstant(value='{{fpc-cpu-usage-threshold}}'),
                                description='This field is for linecard cpu usage threshold',
                                field_name='linecard-cpu-usage-threshold'),
                RuleSchemaField(constant=RuleSchemaConstant(value='{{fpc-heap-usage-threshold}}'),
                                description='This field is for linecard heap usage threshold',
                                field_name='linecard-heap-usage-threshold')]

    rs.keys = ['slot']

    rs.variable = [{'description': 'Linecard Buffer Memory usage threshold value',
                    'name': 'fpc-buffer-usage-threshold',
                    'type': 'int',
                    'value': '80'},
                   {'description': 'Linecard CPU usage threshold value',
                    'name': 'fpc-cpu-usage-threshold',
                    'type': 'int',
                    'value': '80'},
                   {'description': 'Linecard Heap Memory usage threshold value',
                    'name': 'fpc-heap-usage-threshold',
                    'type': 'int',
                    'value': '80'}]

    rs.trigger = [{'description': 'Sets health based on linecard buffer memory',
                   'frequency': '60s',
                   'synopsis': 'Linecard buffer memory kpi',
                   'term': [{'term-name': 'is-buffer-memory-utilization-greater-than-threshold',
                             'then': {'status': {'color': 'red',
                                                 'message': 'FPC buffer memory '
                                                            'utilization '
                                                            '($memory-buffer-utilization) '
                                                            'is over threshold '
                                                            '($linecard-buffer-usage-threshold)'}},
                             'when': {'greater-than': [{'left-operand': '$memory-buffer-utilization',
                                                        'right-operand': '$linecard-buffer-usage-threshold'}]}},
                            {'term-name': 'buffer-utilization-less-than-threshold',
                             'then': {'status': {'color': 'green'}}}],
                   'trigger-name': 'fpc-buffer-memory-utilization'},
                  {'description': 'Sets health based on linecard cpu utilization',
                   'frequency': '60s',
                   'synopsis': 'Linecard cpu utilization kpi',
                   'term': [{'term-name': 'is-cpu-utilization-greater-than-80',
                             'then': {'status': {'color': 'red',
                                                 'message': 'FPC CPU utilization '
                                                            '($cpu-total) is over '
                                                            'threshold '
                                                            '($linecard-cpu-usage-threshold)'}},
                             'when': {'greater-than': [{'left-operand': '$cpu-total',
                                                        'right-operand': '$linecard-cpu-usage-threshold',
                                                        'time-range': '180s'}]}},
                            {'term-name': 'cpu-utilization-less-than-threshold',
                             'then': {'status': {'color': 'green'}}}],
                   'trigger-name': 'fpc-cpu-utilization'},
                  {'description': 'Sets health based on linecard heap memory '
                                  'utilization',
                   'frequency': '60s',
                   'synopsis': 'Linecard heap memory kpi',
                   'term': [{'term-name': 'is-heap-memory-utilization-greater-than-threshold',
                             'then': {'status': {'color': 'red',
                                                 'message': 'FPC heap memory '
                                                            'utilization '
                                                            '($memory-heap-utilization) '
                                                            'is over threshold '
                                                            '($linecard-heap-usage-threshold)'}},
                             'when': {'greater-than': [{'left-operand': '$memory-heap-utilization',
                                                        'right-operand': '$linecard-heap-usage-threshold'}]}},
                            {'term-name': 'heap-memory-utilization-less-than-threshold',
                             'then': {'status': {'color': 'green'}}}],
                   'trigger-name': 'fpc-heap-memory-utilization'}]
    hb.rule.add('hbez', schema=rs)
Returns:
True if action successful
delete(topic_name: str, rule_name: str)[source]

Delete rule under given topic

Parameters:
  • topic_name (str) – The name of the topic under which rule need to deleted
  • rule_name (str) – The name of the rule to be deleted

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    hb.rule.delete('linecard.ospf', 'check-ddos-statistics')
get(topic_name: str, rule_name: str = None, uncommitted: bool = True)[source]

get rule(s) details under given topic

Parameters:
  • topic_name (str) – The name of the topic under which rule need to be fetched
  • rule_name (str) – The name of the rule under given topic If none return list for all Rule
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.rule.get('linecard.ospf', 'check-ddos-statistics')

    print(hb.rule.get('linecard.ospf')
update(topic_name: str, schema: jnpr.healthbot.swagger.models.rule_schema.RuleSchema = None, **kwargs)[source]

Update RuleSchema for given rule schema object

Passing Schema invoke put and kwargs post

Parameters:
  • topic_name (str) – The name of the topic under which rule need to be updated
  • schema (obj) –

    RuleSchema

  • kwargs (object) – key values, which can be used to create RuleSchema

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.rule.get(topic_name='hbez', rule_name="hbez-fpc-heap-utilization")
    schemaObj.description = "HbEZ example"
    hb.rule.update(topic_name='hbez', schemaObj)
Returns:True when OK
upload_rule_file(filename)[source]
Parameters:filename – File to be loaded
Returns:return True of OK
class jnpr.healthbot.modules.rules.Topic(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(topic_name: str = None, uncommitted: bool = True)[source]
Get TopicSchema(s)
for given topic name or all topics in HealthBot system

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.topic.get('linecard.ospf'))
    topics = hb.topic.get()
    for topic in topics:
        print(topic)
Returns:Single/list of TopicSchema

playbook

class jnpr.healthbot.modules.playbooks.Playbook(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
add(schema: jnpr.healthbot.swagger.models.playbook_schema.PlaybookSchema = None, **kwargs)[source]

Add playbook

Parameters:
  • schema (object) – PlaybookSchema
  • kwargs (object) –

    key values, which can be used to create PlaybookSchema Check PlaybookSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    hb.playbook.add(playbook_name="HbEZ-example",
            rules = ['protocol.infra/check-task-momory-usage'])

# or
from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import PlaybookSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    pbs = PlaybookSchema(playbook_name="HbEZ-example",
            rules = ['protocol.infra/check-task-momory-usage'])
    hb.playbook.add(pbs)
Returns:
True if action successful
delete(playbook_name: str)[source]

Delete playbook

Parameters:playbook_name (str) – The playbook name to deleted

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    hb.playbook.delete('linecard-kpis-playbook')
get(playbook_name: str = None, uncommitted: bool = True)[source]

get playbook details

Parameters:
  • playbook_name (str) – Name of the playbook
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.playbook.get('linecard-kpis-playbook'))

    # for all
    print(hb.playbook.get())
update(schema: jnpr.healthbot.swagger.models.playbook_schema.PlaybookSchema = None, **kwargs)[source]

Update PlaybookSchema for given playbook schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    PlaybookSchema

  • kwargs (object) –

    key values, which can be used to create PlaybookSchema Check PlaybookSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.playbook.get('xyz')
    schemaObj.description = 'changed description'
    hb.playbook.update(schemaObj)
Returns:True when OK
upload_playbook_file(filename)[source]
Parameters:filename – File to be loaded
Returns:return True of OK
class jnpr.healthbot.modules.playbooks.PlayBookInstanceBuilder(hbot, playbook: str, instance: str = None, device_group_name: str = None)[source]

Bases: jnpr.healthbot.modules.playbooks.Playbook

__init__(hbot, playbook: str, instance: str = None, device_group_name: str = None)[source]

Help in building and applying playbook instance

Parameters:
  • hbot – HealthBOtClient instance
  • playbook – Playbook name for which instance need to be created
  • instance – Playbook instance name
  • device_group_name – Device group which will be associated with instance

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:

    from jnpr.healthbot import PlayBookInstanceBuilder
    pbb = PlayBookInstanceBuilder(hb, 'forwarding-table-summary', 'HbEZ-instance', 'Core')

    variable = pbb.rule_variables["protocol.routesummary/check-fib-summary"]
    variable.route_address_family = 'pqr'
    variable.route_count_threshold = 100

    # Apply variable to given device(s)
    pbb.apply(device_ids=['vmx'])

    #clear all the variable if you want to set it something else for group or other device(s)
    pbb.clear()

    variable = pbb.rule_variables["protocol.routesummary/check-fib-summary"]
    variable.route_address_family = 'abc'
    variable.route_count_threshold = 200

    pbb.apply()

    hb.commit()
apply(device_ids: list = None, commit: bool = False)[source]

Apply the playbook instance

Parameters:
  • device_ids – if the rule variables need to be associated for given device id(s). Default to device group
  • commit – Pass true if need to commit the changes

Example:

from jnpr.healthbot import PlayBookInstanceBuilder
pbb = PlayBookInstanceBuilder(hb, 'forwarding-table-summary', 'HbEZ-instance', 'Core')
pbb.apply()
Returns:True if all OK
clear()[source]

Clear the old set values to rule variables :return: None

delete()[source]

Delete playbook instance

Example:

from jnpr.healthbot import PlayBookInstanceBuilder
pbb = PlayBookInstanceBuilder(hb, 'forwarding-table-summary', 'HbEZ-instance', 'Core')
pbb.delete()
Returns:True if success
playbook_schema
rules
rule_variables
device_variable

health

settings

class jnpr.healthbot.modules.settings.Settings(hbot)[source]

Bases: object

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
class jnpr.healthbot.modules.settings.Notification(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(notification_name: str = None, uncommitted: bool = True)[source]

Get NotificationSchema(s) for given notification name or list for all

Parameters:
  • notification_name – ID of notification-name
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.settings.notification.get('xyz')
Returns:NotificationSchema(s)
add(schema: jnpr.healthbot.swagger.models.notification_schema.NotificationSchema = None, **kwargs)[source]

Add notification to HealthBot

Parameters:
  • schema (object) – NotificationSchema
  • kwargs (object) –

    key values, which can be used to create NotificationSchema Check NotificationSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import NotificationSchema, NotificationSchemaSlack

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    ns = NotificationSchema(notification_name='HbEZ-notification')
    ns.description = "example of adding notification via API"
    ns.slack = NotificationSchemaSlack(channel="HbEZ", url='http://testing')
    hb.settings.notification.add(ns)
Returns:True when OK
delete(notification_name: str)[source]

Remove notification from settings

Parameters:notification_name (str) – The name of the notification to be deleted

Example:

hb.settings.notification.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.notification_schema.NotificationSchema = None, **kwargs)[source]

Update NotificationSchema for given NotificationSchema schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    NotificationSchema

  • kwargs (object) –

    key values, which can be used to create RetentionPolicySchema Check NotificationSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.notification.get('xyz')
    schemaObj.description = 'changed description'
    hb.settings.notification.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.settings.RetentionPolicy(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(retention_policy_name: str = None, uncommitted=True)[source]

Get RetentionPolicySchema(s) for given retention policy name or list for all

Parameters:
  • retention_policy_name – ID of retention-policy-name
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.settings.retention_policy.get('xyz')

    # for all
    print(hb.settings.retention_policy.get()
Returns:RetentionPolicySchema(s)
add(schema: jnpr.healthbot.swagger.models.retention_policy_schema.RetentionPolicySchema = None, **kwargs)[source]

Add notification to HealthBot

Parameters:

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import RetentionPolicySchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    rps = RetentionPolicySchema(retention_policy_name='HbEZ-rentention-policy')
    hb.settings.retention_policy.add(rps)
Returns:True when OK
delete(retention_policy_name: str)[source]

Remove notification from settings

Parameters:retention_policy_name (str) – The name of the retention policy to be deleted

Example:

hb.settings.retention_policy.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.retention_policy_schema.RetentionPolicySchema = None, **kwargs)[source]

Update RetentionPolicySchema for given RetentionPolicySchema schema

Passing Schema invoke put and kwargs post

Parameters:

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.retention_policy.get('xyz')
    schemaObj.description = 'changed description'
    hb.settings.retention_policy.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.settings.Scheduler(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(name: str = None, uncommitted: bool = True)[source]

Get SchedulerSchema(s) for given scheduler name or list for all

Parameters:
  • name – scheduler name
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.settings.scheduler.get('xyz')

    # for all
    print(hb.settings.scheduler.get()
Returns:SchedulerSchema(s)
add(schema: jnpr.healthbot.swagger.models.scheduler_schema.SchedulerSchema = None, **kwargs)[source]

Add scheduler to HealthBot

Parameters:
  • schema (object) – SchedulerSchema
  • kwargs (object) –

    key values, which can be used to create SchedulerSchema Check SchedulerSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import SchedulerSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    sc = SchedulerSchema(name='HbEZ', repeat={'every': 'week'},
            start_time="2019-07-22T05:32:23Z")
    hb.settings.scheduler.add(sc)
Returns:True when OK
delete(name: str)[source]

Remove notification from settings

Parameters:name (str) – The name of the scheduler to be deleted

Example:

hb.settings.scheduler.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.scheduler_schema.SchedulerSchema = None, **kwargs)[source]

Update SchedulerSchema for given scheduler schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    SchedulerSchema

  • kwargs (object) –

    key values, which can be used to create SchedulerSchema Check SchedulerSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.scheduler.get('xyz')
    schemaObj.description = 'changed description'
    hb.settings.scheduler.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.settings.Destination(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(name: str = None, uncommitted: bool = True)[source]

Get DestinationSchema(s) for given destination name or list for all

Parameters:
  • name – destination ID
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.settings.destination.get('xyz')

    # for all
    print(hb.settings.destination.get()
Returns:DestinationSchema(s)
add(schema: jnpr.healthbot.swagger.models.destination_schema.DestinationSchema = None, **kwargs)[source]

Add destination to HealthBot

Parameters:
  • schema (object) – DestinationSchema
  • kwargs (object) –

    key values, which can be used to create DestinationSchema Check DestinationSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import DestinationSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    ds = DestinationSchema(name='HbEZ-destination')
    hb.settings.destination.add(ds)
Returns:True when OK
delete(name: str)[source]

Remove destination from settings

Parameters:name (str) – The ID name of the destination to be deleted

Example:

hb.settings.destination.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.destination_schema.DestinationSchema = None, **kwargs)[source]

Update DestinationSchema for given destination schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    DestinationSchema

  • kwargs (object) –

    key values, which can be used to create DestinationSchema Check DestinationSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.destination.get('xyz')
    schemaObj.description = 'changed description'
    hb.settings.destination.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.settings.Report(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(name: str = None, uncommitted: bool = True)[source]

Get ReportSchema(s) for given report name or list for all

Parameters:
  • name – report ID
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.settings.report.get('xyz')

    # for all
    print(hb.settings.report.get()
Returns:ReportSchema(s)
add(schema: jnpr.healthbot.swagger.models.report_schema.ReportSchema = None, **kwargs)[source]

Add report to HealthBot

Parameters:
  • schema (object) – ReportSchema
  • kwargs (object) –

    key values, which can be used to create ReportSchema Check ReportSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import ReportSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:

    from jnpr.healthbot import SchedulerSchema
    sc = SchedulerSchema(name='HbEZ-schedule', repeat={'every': 'week'},
                    start_time="2019-07-22T05:32:23Z")
    hb.settings.scheduler.add(sc)

    from jnpr.healthbot import DestinationSchema
    ds = DestinationSchema(name='HbEZ-destination',
                    email={'id': 'nitinkr@juniper.net'})
    hb.settings.destination.add(ds)

    from jnpr.healthbot import ReportSchema
    rs = ReportSchema(name="HbEZ-report", destination=['HbEZ-destination'],
                    format="html", schedule=["HbEZ-schedule"])
    hb.settings.report.add(rs)
Returns:True when OK
delete(name: str)[source]

Remove report from settings

Parameters:name (str) – The name of the report to be deleted

Example:

hb.settings.report.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.report_schema.ReportSchema = None, **kwargs)[source]

Update ReportSchema for given report schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    ReportSchema

  • kwargs (object) –

    key values, which can be used to create ReportSchema Check ReportSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.report.get('xyz')
    schemaObj.description = 'changed description'
    hb.settings.report.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.settings.LicenseKeyManagement(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get_features()[source]

Get LicenseFeatureSchema(s) for given license id or for all licence id

Parameters:license_id – License ID

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.settings.license.get_features()
Returns:LicenseFeatureSchema(s)
get_ids()[source]

List of all licence id

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    # print all existing licence ids
    print(hb.settings.license.get()
Returns:List of license ids
get(license_id: str = None)[source]

Get LicenseKeySchema(s) for given license id or for all licence id

Parameters:license_id – License ID

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    print(hb.settings.license.get()

    # for given licence id
    print(hb.settings.report.get('xxxxx')
Returns:LicenseKeySchema(s)
add(license_file)[source]

Add report to HealthBot

Parameters:license_file (path) – license file path

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    hb.settings.license.add(license_file='/var/tmp/xyz')
Returns:license_id if OK
delete(license_id: str)[source]

Remove report from settings

Parameters:license_id (str) – The license id be deleted

Example:

hb.settings.license.delete('xx-xxx-xxx-xxx-xx')
Returns:True when OK
class jnpr.healthbot.modules.settings.Deployment(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
add(schema: jnpr.healthbot.swagger.models.deployment_schema.DeploymentSchema = None, ip=None)[source]
get(uncommitted: bool = True)[source]
delete()[source]
update(schema: jnpr.healthbot.swagger.models.deployment_schema.DeploymentSchema = None, ip=None)[source]
class jnpr.healthbot.modules.settings.SnmpNotification(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
add(schema: jnpr.healthbot.swagger.models.snmp_notification_schema.SnmpNotificationSchema = None, **kwargs)[source]
update(schema: jnpr.healthbot.swagger.models.snmp_notification_schema.SnmpNotificationSchema = None, **kwargs)[source]
get(uncommitted: bool = True)[source]
delete()[source]

profile

class jnpr.healthbot.modules.profiles.Profile(hbot)[source]

Bases: object

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
class jnpr.healthbot.modules.profiles.Security(hbot)[source]

Bases: object

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
class jnpr.healthbot.modules.profiles.CaProfile(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(name: str = None, uncommitted: bool = True)[source]

Get CaProfileSchema(s) for given ca profile name or list for all

Parameters:
  • name – ID of name
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes
Example:
::

from jnpr.healthbot import HealthBotClient

with HealthBotClient(‘xx.xxx.x.xx’, ‘xxxx’, ‘xxxx’) as hb:

print(hb.settings.security.ca_profile.get(‘xyz’)

# for all print(hb.settings.security.ca_profile.get()

Returns:CaProfileSchema(s)
add(schema: jnpr.healthbot.swagger.models.ca_profile_schema.CaProfileSchema = None, **kwargs)[source]

Add ca profile to HealthBot. The onus of uploading helper file certificate_authority_crt is on user. They should use hb.upload_helper_file API to make sure these crt file are uploaded in system. We don’t do that validation as user can also upload these file after configuring profiles.

Parameters:
  • schema (object) – CaProfileSchema
  • kwargs (object) –

    key values, which can be used to create CaProfileSchema Check CaProfileSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import CaProfileSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    ca_prof_schema = CaProfileSchema(certificate_authority_crt='abc.crt', name='hbez')
    hb.settings.security.ca_profile.add(ca_prof_schema)
Returns:True when OK
delete(name: str)[source]

Remove ca profile from security settings

Parameters:name (str) – The name of the ca_profile to be deleted

Example:

hb.settings.security.ca_profile.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.ca_profile_schema.CaProfileSchema = None, **kwargs)[source]

Update CaProfileSchema for given ca profile schema

Passing Schema invoke put and kwargs post

Parameters:
  • schema (obj) –

    CaProfileSchema

  • kwargs (object) –

    key values, which can be used to create CaProfileSchema Check CaProfileSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.security.ca_profile.get('xyz')
    schemaObj.certificate_authority_crt = 'pqr.crt'
    hb.settings.security.ca_profile.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.profiles.LocalCertificate(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(name: str = None, uncommitted: bool = True)[source]

Get LocalCertificateSchema(s) for given local certificate name or list for all

Parameters:
  • name – ID of name
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes
Example:
::

from jnpr.healthbot import HealthBotClient

with HealthBotClient(‘xx.xxx.x.xx’, ‘xxxx’, ‘xxxx’) as hb:

print(hb.settings.security.local_certificate.get(‘xyz’)

# for all print(hb.settings.security.local_certificate.get()

Returns:LocalCertificateSchema(s)
add(schema: jnpr.healthbot.swagger.models.local_certificate_schema.LocalCertificateSchema = None, **kwargs)[source]

Add local certificate to security settings of HealthBot. The onus of uploading helper file (cert and key) is on user. They should use hb.upload_helper_file API to make sure these crt/key file are uploaded in system. We don’t do that validation as user can also upload these file after configuring profiles.

Parameters:

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import LocalCertificateSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    local_cert_schema = LocalCertificateSchema(client_crt='abc.crt', client_key='pqr.key', name='hbez')
    hb.settings.security.local_certificate.add(local_cert_schema)
Returns:True when OK
delete(name: str)[source]

Remove local certificate from security settings

Parameters:name (str) – The name of the local_certificate to be deleted

Example:

hb.settings.security.local_certificate.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.local_certificate_schema.LocalCertificateSchema = None, **kwargs)[source]

Update LocalCertificateSchema for given local certificate schema

Passing Schema invoke put and kwargs post

Parameters:

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.security.local_certificate.get('xyz')
    schemaObj.client_key = 'xyz.key'
    hb.settings.security.local_certificate.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.profiles.SshKeyProfile(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get(name: str = None, uncommitted: bool = True)[source]

Get SshKeyProfileSchema(s) for given ssh key profile name or list for all

Parameters:
  • name – ID of name
  • uncommitted (bool) – True includes fetches uncommitted changes, False restricts data set to only committed changes
Example:
::

from jnpr.healthbot import HealthBotClient

with HealthBotClient(‘xx.xxx.x.xx’, ‘xxxx’, ‘xxxx’) as hb:

print(hb.settings.security.ssh_key_profile.get(‘xyz’)

# for all print(hb.settings.security.ssh_key_profile.get()

Returns:SshKeyProfileSchema(s)
add(schema: jnpr.healthbot.swagger.models.ssh_key_profile_schema.SshKeyProfileSchema = None, **kwargs)[source]

Add ssh key profile to HealthBot. The onus of uploading helper file ssh_private_key_file is on user. They should use hb.upload_helper_file API to make sure these key file are uploaded in system. We don’t do that validation as user can also upload these file after configuring profiles.

Parameters:
  • schema (object) – SshKeyProfileSchema
  • kwargs (object) –

    key values, which can be used to create SshKeyProfileSchema Check SshKeyProfileSchema for details about which all keys can be used

Example:

from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import SshKeyProfileSchema

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    ssh_key_prof_schema = SshKeyProfileSchema(name='hbez', ssh_private_key_file='abc.crt',
        ssh_private_key_passphrase='%$#@#')
    hb.settings.security.ssh_key_profile.add(ssh_key_prof_schema)
Returns:True when OK
delete(name: str)[source]

Remove ssh key profile from security settings

Parameters:name (str) – The name of the ssh key profile to be deleted

Example:

hb.settings.security.ssh_key_profile.delete('xyz')
hb.commit()
Returns:True when OK
update(schema: jnpr.healthbot.swagger.models.ssh_key_profile_schema.SshKeyProfileSchema = None, **kwargs)[source]

Update SshKeyProfileSchema for given ssh key profile schema

Passing Schema invoke put and kwargs post

Parameters:

Example:

from jnpr.healthbot import HealthBotClient

with HealthBotClient('xx.xxx.x.xx', 'xxxx', 'xxxx') as hb:
    schemaObj = hb.settings.security.ssh_key_profile.get('xyz')
    schemaObj.certificate_authority_crt = 'pqr.crt'
    hb.settings.security.ssh_key_profile.update(schemaObj)
Returns:True when OK
class jnpr.healthbot.modules.profiles.DataSummarization(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
class jnpr.healthbot.modules.profiles.Raw(hbot)[source]

Bases: jnpr.healthbot.modules.BaseModule

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance
get()[source]
add()[source]
delete(name: str)[source]
update()[source]

database

class jnpr.healthbot.modules.database.Database(hbot)[source]

Bases: influxdb.client.InfluxDBClient

__init__(hbot)[source]
Parameters:hbot (object) – jnpr.healthbot.HealthBotClient client instance

Example:

hb.tsdb.query("show databases")
hb.tsdb.query('select * from "protocol-eventd-host/check-host-traffic/packet-loss" limit 10',
                  database='Core:vmx')
api
get_table()[source]

Get list of tables

Returns:list of TableSchema