Healthbot files management (rules, playbooks, functions, tables and views) with CURL - ksator/junos_monitoring_with_healthbot GitHub Wiki
The directory tables_and_views has tables and views examples
The directory rules has rules examples
The directory playbooks has playbooks examples
The directory functions has functions examples
We will see how to load files (rules, playbooks, functions, tables and views) to healthbot using healthbot API with curl
tables and views management
Add a table to Heathbot
$ curl -X POST "https://100.123.35.0:8080/api/v1/files/helper-files/ospf.yml" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure -F "up_file=@tables_and_views/ospf.yml"
Get a table from Healthbot
$ curl -X GET "https://100.123.35.0:8080/api/v1/files/helper-files/ospf.yml" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
Remove a table from Heathboth
$ curl -X DELETE "https://100.123.35.0:8080/api/v1/files/helper-files/ospf.yml" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
functions management
Add a function to Heathboth
$ curl -X POST "https://100.123.35.0:8080/api/v1/files/helper-files/enable_a_disabled_interface.py" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure -F "up_file=@functions/enable_a_disabled_interface.py"
Get a function from Heathboth
$ curl -X GET "https://100.123.35.0:8080/api/v1/files/helper-files/enable_a_disabled_interface.py" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
Remove a function from Heathboth
$ curl -X DELETE "https://100.123.35.0:8080/api/v1/files/helper-files/enable_a_disabled_interface.py" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
topics and rules management
Add a rule to Heathbot candidate configuration
$ curl -X POST --insecure -u jcluser:Juniper\!1 https://100.123.35.0:8080/api/v1/topics/ -H 'Content-Type: multipart/form-data' -F topics=@rules/check-bgp-state-using-snmp.rule
Get a topic from the candidate configuration
$ curl -X GET "https://100.123.35.0:8080/api/v1/topic/bgp/?working=true" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
Commit the candidate configuration
$ curl -X POST "https://100.123.35.0:8080/api/v1/configuration" -u jcluser:Juniper\!1 --insecure
Get a topic from the running configuration
$ curl -X GET "https://100.123.35.0:8080/api/v1/topic/bgp/" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
playbooks management
Add a playbook to healthbot candidate configuration
$ curl -X POST --insecure -u jcluser:Juniper\!1 https://100.123.35.0:8080/api/v1/playbooks/ -H 'Content-Type: multipart/form-data' -F playbooks=@playbooks/interfaces-using-snmp.playbook
Get all playbooks from the candidate configuration
$ curl -X GET "https://100.123.35.0:8080/api/v1/playbooks/?working=true" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
Get a playbook from the candidate configuration
$ curl -X GET "https://100.123.35.0:8080/api/v1/playbook/interfaces-using-snmp/?working=true" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
Commit the candidate configuration
$ curl -X POST "https://100.123.35.0:8080/api/v1/configuration" -u jcluser:Juniper\!1 --insecure
Get a playbook from the running configuration
$ curl -X GET "https://100.123.35.0:8080/api/v1/playbook/interfaces-using-snmp/" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
Get all playbooks from the running configuration
$ curl -X GET "https://100.123.35.0:8080/api/v1/playbooks/" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
Delete a playbook from the candidate configuration
$ curl -X DELETE "https://100.123.35.0:8080/api/v1/playbook/interfaces-using-snmp/" -H "accept: application/json" -H "Content-Type: multipart/form-data" -u jcluser:Juniper\!1 --insecure
commit the candidate configuration
$ curl -X POST "https://100.123.35.0:8080/api/v1/configuration" -u jcluser:Juniper\!1 --insecure