Exportd with script arguments

Hi all

I am trying a workaround for the creation of the OpenNMS requisition creation through the onmsctl tool.

I’ve downloaded and installed the tool and i am trying to call it through the ExternalSystemExecuteScript.

The command i am trying to use is the:
onmsctl inv req add Requisition_Name

I’ve created the match condition and tried to call the script through the following:

As i have understood the script will be called and at the end it will append the following:

The type I am using has the following definition:

I’ve also created the json file to allow DataGerry to run the script, however i am getting some errors which do not provide much info e.g.

Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][WARNING ] — unexpected char ‘“’ at 9 (exporter_base.py)
Nov 8 17:25:29 cmdbsrv datagerry: [2020-11-08 17:25:29][ERROR ] — Extra data: line 1 column 18 (char 17) (service.py)

Any help will be appreciated.

Hello,
True, i have the same error for a long time ago and it is from exportd jobs
example:

Errors

[2021-02-23 10:58:27][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:30][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:30][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:31][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:31][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:32][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:32][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:33][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:33][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:34][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:58:52][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:07][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:07][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:13][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:18][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:22][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:27][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:27][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:36][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:36][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:55][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 10:59:55][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:06][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:06][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:06][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:12][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:15][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:22][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:26][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:36][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:42][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:43][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:43][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:00:47][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:01:06][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:01:19][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:01:19][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:01:23][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:01:23][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)
[2021-02-23 11:01:34][ERROR ] — type object argument after ** must be a mapping, not NoneType (template_data.py)

Hi @marcinw

Is your script running successfully?

I gave up on the script approach and would like to make it work if possible.

Hi @kbetsis
my jobs from exportd works ok but i still get these communicates.
Somebody know why?

You are lucky…

I cannot figure out why mine does not.
I’ve downloaded a go binary called “onmsctl” which is used for opennms requisitions create/delete/push etc.

It’s hosted under /opt/onmsctl/
I’ve created the datagerry json file as below

cat .datagerry_exec.json
{
“allowed_scripts”: [“onmsctl”]
}

And i’ve created the exportd with the respective script job to be run as:

/opt/onmsctl/onmsctl --url opennms.private.domain --user test --pass ‘somepassword’ inv req del

The exportd will get all enabled branches and propagate their name as the variable at the end.

When i run it I always get the known:

You are not allowed to execute this script. Could not open .datagerry_exec.json file.

What am I doing wrong?

Hello,
Your user has the image
show me your every steps in export job edit


maybe i found something

Hi @marcinw

Please see below

Basic information

Sources

Destinations

Datagerry is running ok and the script details shown below:
onmsctl directory
image
DataGerry JSON file for script permissions
image

Regarding the user it has all permissions since it’s the admin user.
This is the exportd privileges

Don’t know how to edit the "base.exportd.* assigned privileges to be honest if they need changing.

Hello @kbetsis ,
As far as I know, Datagerry is used to provide data, e.g. for a script, not for its execution.
The script, if it has the appropriate data, can run a task in the datagerry if has login password/ token and job is set for PULL and user has rights job.run.
For tool OpenNMS is in tab Destinations:


You should use it not ExternalSystemExecuteScript.
Documentation:
https://docs.datagerry.com/latest/admin_guide/exportd.html

Have i right @sergej.dumler @anon3483405 ?

Hi @marcinw

I know the OpenNMS workflow included in DataGerry, however it does not offer the capability to create requisitions. Hence the script approach.
The “onmsctl” script offers the capability to incorporate the workflow that we want to cover e.g.

  1. Create requisitions
  2. Include requisitions with devices attached to that organization.

I would suggest to treat this as a normal script exportd.

Is there a reason why the script is not run from DataGerry?

Thank you
Best Regards

Hello,
i’m not sure
maybe try change in /etc/passwd from /sbin/nologin to /bin/bash
try log on user datagerry in system, move to that path and do it this script from system.
Maybe this say You something?

Hi @marcinw

Already did that and it works both for root and as datagerry user.

Hi
Are you tried run script without parameters


I don’t know if you can use parameters in this field

your script onmsctl takes json values? can read them?

Hi @marcinw

No, it gets clear text input.
I think I might need to create a wrapper as to extract the JSON values once this fails due to the input and the authorization is fixed…

The parameters are needed as to guide the script to which remote server to connect to.