Skip to content

Releases: Juniper/healthbot-py-client

v4.1.0 Release

29 Dec 08:13
f97c282
Compare
Choose a tag to compare

What's new?

  • Support configuring of Healthbot Charts
  • Fix bug while uploading helper files
  • Few example scripts have been added

Configure hb charts when there is device-group present and there is a running playbook for it

from jnpr.healthbot.swagger.models.hb_graphs_query import HbGraphsQuery
from jnpr.healthbot.swagger.models.hb_graphs import HbGraphs
from jnpr.healthbot import HealthBotClient

with HealthBotClient(ip, gui_username, gui_password, port=8080) as hb:
    # Adding a new canvas
    # group_name, device_name, measurement_name, field_name are compulsory fields here
    query1 = HbGraphsQuery(group_name='dg-junos', device_name="d2", measurement_name="system.commit/commit-history",
                           transformation=None, field_name="l1-threshold", field_aggregation="mean",
                           where=[{'key': "comment", "operator": '=', "value": "new"}],
                           group_by_interval="1s", group_by_fill="fill(null)", group_by_tag_key=[])
    # Multiple queries can be present for a graph
    # graph_name, graph_type, time_range are compulsory here
    graph1 = HbGraphs(graph_name="graph1", graph_description=None, graph_type="Heatmap",
                      time_range='3h', query=[query1], y_label=None, y_max=None,
                      y_min=None, unit_type=None, decimals=None)
    # Multiple graphs can be present for a canvas
    # Adding a new canvas with a single graph
    hb.charts.add_canvas(canvas_name="mycanvas", graphs=[graph1])
    hb.commit()

    # Updating an existing canvas
    # Edit an existing graph
    query1 = HbGraphsQuery(group_name='dg-junos', device_name="d2", measurement_name="system.commit/commit-history",
                           transformation=None, field_name="l1-threshold", field_aggregation="mean",
                           where=[{'key': "comment", "operator": '!=', "value": "new"}],
                           group_by_interval="1s", group_by_fill="fill(null)", group_by_tag_key=[])
    graph1 = HbGraphs(graph_name="graph1", graph_description=None, graph_type="Time Series",
                      time_range='3h', query=[query1])
    hb.charts.update_canvas(canvas_name="mycanvas", graphs=[graph1])
    hb.commit()

    # Add a new graph
    graph2 = HbGraphs(graph_name="graph2", graph_description=None, graph_type="Time Series",
                      time_range='3h')
    hb.charts.update_canvas(canvas_name="mycanvas", graphs=[graph1, graph2])
    hb.commit()

    # Delete a graph from a canvas
    hb.charts.update_canvas(canvas_name="mycanvas", graphs=[graph2])
    hb.commit()

    # Getting canvas details
    pprint(hb.charts.get_canvas("mycanvas"))

    # Deleting an canvas
    hb.charts.delete_canvas(canvas_name="mycanvas")
    hb.commit()

Note:

This version is only compatible with Paragon Insight 4.0.0 and above. For previous releases of Healthbot please use v2.0.0

v4.0.0 Release

04 Aug 10:53
cf2430c
Compare
Choose a tag to compare

Supports Paragon Insights 4.0.0 version

Whats new ?

  • Supports SOCKS based proxy, in addition to HTTP based proxy
  • No longer support Administration APIs

Note:

This version is only compatible with Paragon Insight 4.0.0 and above. For previous releases of Healthbot please use v2.0.0

v2.0.0 Release

13 May 14:12
bb81452
Compare
Choose a tag to compare

With RBAC changes in Healthbot API calls will be token bases. After a certain given time token expires.

HbEZ will internally take care of all this using with context manager

from jnpr.healthbot import HealthBotClient
from pprint import pprint

with HealthBotClient('xx.xx.xx.xx.xx', 'xxx', 'xxxx') as hb:
    print(hb.device.get_ids())

Added Administration APIs

from jnpr.healthbot import HealthBotClient
from pprint import pprint

with HealthBotClient('xx.xx.xx.xx.xx', 'xxx', 'xxxx') as hb:
    schema = hb.administration.group.get(group_name="hboperator")
    pprint(schema)
    group_id = hb.administration.group.get_groupid_from_group_name('hboperator')
    user = UserSchema(user_name="xxx", first_name="xxx", last_name="xx", password="xxx",
                      email="abcd.kri@gmail.com", active=True, groups=[UserSchemaGroups(group_id=group_id,
                                                                                      group_name="hboperator")])
    hb.administration.user.add(user)
    pprint(hb.administration.user.get(user_name="xxx"))
    pprint(hb.administration.user.get("xxx-xx-xx-xx-xxx"))
    print(hb.administration.user.delete(user_name='hbez'))
    obj = hb.administration.user.get(user_name="hbez")
    obj.last_name = "Kumar"
    print(hb.administration.user.update(schema=obj))
    print(hb.administration.user.get_userid_from_user_name(user_name="hbez"))
    print(hb.administration.user.delete(user_name='hbez'))

    data = hb.administration.group.get(group_name="test")
    pprint(data)
    pprint(hb.administration.group.delete(group_name="test"))
    userid = hb.administration.user.get_userid_from_user_name(user_name="hbez")
    schema = Groups(group_name='test', group_description="testing",
                    roles=[GroupgroupidRoles(role_id='xxx-xx-xx-xx-xx',
                                             role_name='token:write')],
                    users=[AssociatedUserSchemaInner(user_id=userid, user_name="xxx")])
    print(hb.administration.group.add(schema))
    schema = hb.administration.group.get(group_name="test")
    schema.users.append(AssociatedUserSchemaInner(user_id=
                           hb.administration.user.get_userid_from_user_name(
                               user_name="mc"), user_name="mc"))
    print(hb.administration.group.update(schema=schema))
    print(hb.administration.role.get(role_id="xxx-xx-xx-xx-xx"))
    print(hb.administration.role.get(role_name='data-store:write'))

Added License APIs

from jnpr.healthbot import HealthBotClient
from pprint import pprint

with HealthBotClient('xx.xx.xx.xx.xx', 'xxx', 'xxxx') as hb:
    pprint(hb.settings.license.get_ids())
    pprint(hb.settings.license.get_features())
    pprint(hb.settings.license.get('xxx-xx-xxx-xxx-xx'))
    pprint(hb.settings.license.get())
    pprint(hb.settings.license.add(license_file='/var/tmp/license.txt'))
    pprint(hb.settings.license.get())
    pprint(hb.settings.license.delete('xxx-xx-xxx-xxx-xx'))

v1.0.0 Release

30 Sep 11:29
Compare
Choose a tag to compare

First version of HbEZ.

For more details refer
https://hbez.readthedocs.io/en/latest/