NetXMS Support Forum

Please login or register.

Login with username, password and session length

Author Topic: ActionShellExec it doesnt works with agent configuration Policy  (Read 257 times)

Luis Montaño

  • Newbie
  • *
  • Posts: 29
    • View Profile
ActionShellExec it doesnt works with agent configuration Policy
« 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
Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6536
    • View Profile
Re: ActionShellExec it doesnt works with agent configuration Policy
« Reply #1 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
Logged

Luis Montaño

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: ActionShellExec it doesnt works with agent configuration Policy
« Reply #2 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?
Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6536
    • View Profile
Re: ActionShellExec it doesnt works with agent configuration Policy
« Reply #3 on: February 02, 2019, 02:14:02 pm »

Currently no. We have a feature request for that.

Best regards,
Victor
Logged