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
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
Thanks Victor, it works perfectly.
¿Is there a way to automaticaly restart agent after a policy change?
Currently no. We have a feature request for that.
Best regards,
Victor