NetXMS Support Forum

Please login or register.

Login with username, password and session length

Author Topic: Agent Config (Action / ExternalParam)  (Read 22466 times)


  • Full Member
  • ***
  • Posts: 104
    • View Profile
Agent Config (Action / ExternalParam)
« on: June 12, 2009, 05:18:46 pm »

Dear all,

Could some one, please, elaborate a bit on how to configure AND use "Action", "ExternalParameter" and "ExternalParameterShellExec"?
The available documentation presents a "dead loop" in section "Agent configuration" pointers are pointing to this same section for more details...
Unfortunately, I did not find any complete explanation on this forum though there are some very interseting topics.

Many Thanks in advance for your help/support. ;D

Expected info:
- Syntax for action definition in nxagentd.conf (not in doc)
- How to use returned / collected info in NetXMS console for both action and external parameter

A nice way would be to explain how to - for example - execute a script or system command (ping, ps or netstat), extract some info after treatment of the output (grep, wc, cut, sed and the like), define event and threshold related to returned info.

Suggestion: copy/past your contribution to the user manual  ;)



  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Agent Config (Action / ExternalParam)
« Reply #1 on: June 19, 2009, 05:17:54 pm »

Well as I managed to get through some of this by myself, I'm summarizing a small "HowTo" so you can as well enjoy...

Actions can be defined on the server using the panel "Actions". Very easy, one shall only follow the kind of wizard.
So far I only used the sending of email for which one shall not forget to define both SMTP server (SMTPserver parameter) and server email address (SMTPFromAddr parameter)

Using the macros provided on the last page of the user manual, one can easily format both email content and subject.

Note, if you want to put several email addresses for destination, use the ";" to separate them. Funny is that as recipient you don't see who else has received the email from NetXMS.

ExternalParameter and ExternalParameterShellExec
The difference is explained somewhere in the forum or user manual. The ShellExec is to be used for those processes or parameters that are interpreted by some additional process: bash, perl or the like.

Then in your agent configuration file (pay attention to respect the declaration order see Log Parser issue in this forum) you define the script you want to run and that is providing the data which will be collected to get graphed or monitored in order to generate alarms.

Syntax is:
ExternalParameterShellExec=<data_collection_name>{(*)}: <script_path> {$1} {$2} .. {$i}
where <data_collection_name> will be your reference to be used in the data collection definition in NetXMS console, you will have to append (*) to the name if you have parameters to provide. Those parameters are represented by the optional $1, $2... $i. As many as you have parameters.

So example:
ExternalParameterShellExec=my_data_coll(*): /home/netxms/ $1 $2
This states that you will provide 2 parameters to the script in the data collection definition

Pay attention that in bash the value is returned using echo which in perl, this value is returned by printing out to the standard output. Do not use exit or return.

Pay attention... starting your script by /usr/bin/perl will not call a bash... while ./ does! Taouw... as Homer says :o

Data collection
Now in NetXMS console you want to define the data collection based on this script.

You will have to select the NetXMS Agent as origin and insert your <data_collection_name> which by the way you will not find in the available list. I did not try but I would suggest not to use any existing data collection name... Possible conflict or simply possible problem easy to avoid - play it safe and simple ;-)
There enter as well your parameter(s) if any required.
Up to you to tweak / transform the data or define your threshold.

Hope this helps



Update, Alex: see also
« Last Edit: June 20, 2013, 12:22:20 pm by Alex Kirhenshtein »

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6473
    • View Profile
Re: Agent Config (Action / ExternalParam)
« Reply #2 on: June 21, 2009, 04:40:54 pm »

Thank you for excellent howto! I'll probably never manage to write so long text :)

Some comments and corrections:

which by the way you will not find in the available list

You will, but only after next configuration poll for that node. To prevent sending request for supported parameters to agent each time you press "Select" button in console, server reads list of supported parameters during configuration poll (each hour by default) and caches it. You should either wait for next configuration poll or force immediate configuration poll from console using Poll -> Configuration menu.

I did not try but I would suggest not to use any existing data collection name... Possible conflict or simply possible problem easy to avoid - play it safe and simple ;-)

In fact, you can use names of existing parameters - if you do, built-in parameter's handler will be replaced by your script. Normally, this should be avoided, but sometimes it may help - for example, if built-in implementation of certain parameter is buggy, and you are able to provide replacement script as workaround.

Best regards,