# Exportd with script arguments

**URL:** <https://community.datagerry.com/t/exportd-with-script-arguments/202>\
**Category:** Community Support\
**Created:** [November 8, 2020, 5:34pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202 "2020-11-08T17:34:14Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![kbetsis](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kbetsis](https://community.datagerry.com/u/kbetsis)\
**Post date:** [November 8, 2020, 5:34pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/1 "2020-11-08T17:34:15Z")

</div>

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:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/941156cc1c45c4d65c84a985bcc193f8d761d23f.png)

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

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/5cbb68df3caf30080e06095c02a3d1e6b402fc77.png)

The type I am using has the following definition:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/5acc37a25943710f47e1ea9850f3bb9359af9317.png)

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.

---

<div class="post-metadata">

**Author:** ![marcinw](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@marcinw](https://community.datagerry.com/u/marcinw)\
**Post date:** [February 25, 2021, 12:57pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/2 "2021-02-25T12:57:10Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![kbetsis](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kbetsis](https://community.datagerry.com/u/kbetsis)\
**Post date:** [March 9, 2021, 5:57pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/3 "2021-03-09T17:57:11Z")

</div>

Hi @marcinw

Is your script running successfully?

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

---

<div class="post-metadata">

**Author:** ![marcinw](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@marcinw](https://community.datagerry.com/u/marcinw)\
**Post date:** [March 10, 2021, 9:16am UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/4 "2021-03-10T09:16:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kbetsis](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kbetsis](https://community.datagerry.com/u/kbetsis)\
**Post date:** [March 12, 2021, 7:44pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/5 "2021-03-12T19:44:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![marcinw](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@marcinw](https://community.datagerry.com/u/marcinw)\
**Post date:** [March 15, 2021, 1:33pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/6 "2021-03-15T13:33:57Z")

</div>

Hello,  
Your user has the ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/0ecf75be13db9589dcf77e4d02a3ff8932589c26.png)  
show me your every steps in export job edit

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/7beeb05d8ab5a9cd946aaf880f51a677a816ede4.png)  
maybe i found something

---

<div class="post-metadata">

**Author:** ![kbetsis](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kbetsis](https://community.datagerry.com/u/kbetsis)\
**Post date:** [March 15, 2021, 3:15pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/7 "2021-03-15T15:15:37Z")

</div>

Hi @marcinw

Please see below

Basic information

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/79230ad4fedfff2ab2baae4ce648e1f13ce53c0a.png)

Sources

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/c99d58b58a27a99659c87c14af361fda2db2e450.png)

Destinations

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/b2e52e50616c77c2c8a65f20cbce3a9e5a07b2f6.png)

Datagerry is running ok and the script details shown below:  
onmsctl directory  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/b3f8d3f7d3f67f9ca494ef809b9b5dbbedf56576.png)  
DataGerry JSON file for script permissions  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/fe6d48214b62b6fb4b02bb7cb52d8ace3ecc038c.png)

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

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/8d27176ec77e88b1367ff50a81e47d430edc9bf3.png)

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

---

<div class="post-metadata">

**Author:** ![marcinw](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@marcinw](https://community.datagerry.com/u/marcinw)\
**Post date:** [March 16, 2021, 12:15pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/8 "2021-03-16T12:15:26Z")

</div>

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:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/74398e79a36407d788cfbb6d484f915c9d5e831d.png)  
You should use it not ExternalSystemExecuteScript.  
Documentation:  
[https://docs.datagerry.com/latest/admin\_guide/exportd.html](https://docs.datagerry.com/latest/admin_guide/exportd.html)

Have i right @sergej.dumler @anon3483405 ?

---

<div class="post-metadata">

**Author:** ![kbetsis](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kbetsis](https://community.datagerry.com/u/kbetsis)\
**Post date:** [March 16, 2021, 3:09pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/9 "2021-03-16T15:09:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marcinw](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@marcinw](https://community.datagerry.com/u/marcinw)\
**Post date:** [March 17, 2021, 5:43am UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/10 "2021-03-17T05:43:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kbetsis](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kbetsis](https://community.datagerry.com/u/kbetsis)\
**Post date:** [March 18, 2021, 2:07pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/11 "2021-03-18T14:07:40Z")

</div>

Hi @marcinw

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

---

<div class="post-metadata">

**Author:** ![marcinw](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@marcinw](https://community.datagerry.com/u/marcinw)\
**Post date:** [March 19, 2021, 1:13pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/12 "2021-03-19T13:13:12Z")

</div>

Hi  
Are you tried run script without parameters

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/datagerry/original/1X/c0da0bc97e9746b698aa049f9c3bf5c1730dd2ce.png)  
I don’t know if you can use parameters in this field

your script onmsctl takes json values? can read them?

---

<div class="post-metadata">

**Author:** ![kbetsis](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kbetsis](https://community.datagerry.com/u/kbetsis)\
**Post date:** [March 19, 2021, 3:58pm UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/13 "2021-03-19T15:58:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adnan.smajic](https://dub1.discourse-cdn.com/flex013/user_avatar/community.datagerry.com/adnan.smajic/32/754_2.png) [@adnan.smajic](https://community.datagerry.com/u/adnan.smajic)\
**Post date:** [June 20, 2023, 10:44am UTC](https://community.datagerry.com/t/exportd-with-script-arguments/202/14 "2023-06-20T10:44:16Z")

</div>


