REST API: Maintenance Mode / NXSL Invocation

Started by narellan, August 22, 2022, 11:26:48 PM

Previous topic - Next topic

narellan

I would like to request the ability to put a node in and out of maintenance mode via the REST API. This could also be solved with something more powerful such as allowing NXSL scripts to be sent to devices via the REST API just like you are able to do with execute server script.

I want to incorporate NetXMS into Ansible to be able to do things like:

1. Put nodes into maintenance mode in NetXMS
2. Patch, change, update systems
3. Remove from maintenance mode in NetXMS

turbomuffin

Brilliant idea, I hope the devs see this and incorporate it. I'd use the heck out of this in automation town.

Borgso

#2
Some DevOp in a company i was earlier made a Groovy script for this that could be executed in Ansible.
It was created for earlier version, but  do not have it aviable anymore.

Script used netxms-client library and session.setObjectMaintenanceMode(object.objectId, true, comment) to enter maintenance.

In Ansible "script" was used, something like this:

Quote- name: Enter NetXMS maintenance mode
  become: false
  script:
    ./scripts/netxms-cli enter-maintenance {{ netxms_hostname | default(inventory_hostname) | quote }} --comment "Upgrading linux system"
  vars:
    ansible_command_timeout: 40
  throttle: 5
  delegate_to: localhost
  ignore_errors: yes

narellan

Ideally I would like to be able to do all of this via the REST API.

Sure, I could use even nxshell and jython to do some stuff as well, but I would like to not have to have the Java dependencies just to do some automation actions with NetXMS and Ansible.