NetXMS Support Forum

English Support => General Support => Topic started by: Luis Montaño on February 01, 2019, 12:16:20 AM

Title: ActionShellExec it doesnt works with agent configuration Policy
Post by: Luis Montaño on February 01, 2019, 12:16:20 AM
Hi,

I'm using ActionShellExec option in the configuration file to execute a command on a remote host.
I have the following is my configuration file:

##############################################################config file
MasterServers = CPRG-MRED
ConfigIncludeDir = C:\NetXMS\etc\nxagentd.conf.d
LogFile = {syslog}
FileStore = C:\NetXMS\var
SubAgent = ecs.nsm
SubAgent = filemgr.nsm
SubAgent = ping.nsm
SubAgent = logwatch.nsm
SubAgent = portcheck.nsm
SubAgent = winperf.nsm
SubAgent = wmi.nsm
ActionShellExec=DisplayServices:wmic service get DisplayName,name,startname
##############################################################config file

It works fine , but the problem is when I configure that option in a policy :


<config>
   <agent>
      <!-- there can be added comment -->
      <MasterServers>X.X.X.X</MasterServers>
      <ConfigIncludeDir>C:\NetXMS\etc\nxagentd.conf.d</ConfigIncludeDir>
      <FileStore>C:\NetXMS\var</FileStore>
      <LogFile>{syslog}</LogFile>
      
      ###################################### INI SUBAGENTES
      <SubAgent>ecs.nsm</SubAgent>
      <SubAgent>filemgr.nsm</SubAgent>
      <SubAgent>ping.nsm</SubAgent>
      <SubAgent>logwatch.nsm</SubAgent>
      <SubAgent>portcheck.nsm</SubAgent>
      <SubAgent>winperf.nsm</SubAgent>
      <SubAgent>wmi.nsm</SubAgent>
      <SubAgent>ssh.nsm</SubAgent>   
      <SubAgent>netsvc.nsm</SubAgent>
      <SubAgent>dbquery.nsm</SubAgent>
      ###################################### FIN SUBAGENTES

      <ActionShellExec>DisplayServices:wmic service get DisplayName,name,startname</ActionShellExec>
            
   </agent>
   
   <filemgr>
      <RootFolder>C:\</RootFolder> # read/write access
      <RootFolder>D:\</RootFolder> # read/write access
   </filemgr>

   <WinPerf>
      <EnableDefaultCounters>yes</EnableDefaultCounters>
   </WinPerf>
</config>

It doesnt works anymore and I get an error: Cannot execute action on node CPRG-MCFE: Communication failure
Title: Re: ActionShellExec it doesnt works with agent configuration Policy
Post by: Victor Kirhenshtein on February 01, 2019, 08:12:16 AM
Hi,

replace <agent> tag with <core>. Also, it is not mandatory to use XMS format in policy - you can use same key=value format as in nxagentd.conf.

Best regards,
Victor
Title: Re: ActionShellExec it doesnt works with agent configuration Policy
Post by: Luis Montaño on February 01, 2019, 04:54:23 PM
Thanks Victor, it works perfectly.
¿Is there a way to automaticaly restart agent after a policy change?
Title: Re: ActionShellExec it doesnt works with agent configuration Policy
Post by: Victor Kirhenshtein on February 02, 2019, 02:14:02 PM
Currently no. We have a feature request for that.

Best regards,
Victor