NetXMS Support Forum

English Support => Feature Requests => Topic started by: narellan on August 22, 2022, 11:26:48 PM

Title: REST API: Maintenance Mode / NXSL Invocation
Post by: narellan on August 22, 2022, 11:26:48 PM
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
Title: Re: REST API: Maintenance Mode / NXSL Invocation
Post by: turbomuffin on August 22, 2022, 11:37:42 PM
Brilliant idea, I hope the devs see this and incorporate it. I'd use the heck out of this in automation town.
Title: Re: REST API: Maintenance Mode / NXSL Invocation
Post by: Borgso on August 25, 2022, 05:21:30 PM
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
Title: Re: REST API: Maintenance Mode / NXSL Invocation
Post by: narellan on August 26, 2022, 10:26:38 PM
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.