Agent 1.0.13 Windows 2000 - .Bat results to server

Started by MitchW, April 20, 2020, 03:23:19 PM

Previous topic - Next topic

MitchW

Hello,

We are running NetXMS on a lot of our systems which are windows XP, Windows 7 and Windows Server 201x. The agent is running perfect on those systems and we created some specific powershell scripts which allows us to monitor specific service states and more.

We also have a lot of Windows 2000 systems on which we do not have installed the agent yet. This is what i'm currently testing, and we noticed that version 1.0.13 is still compatible with windows 2000. I installed this agent without any problem and our NetXMS server can "talk" with this system.

The problem I have now is that I want to create specific .bat files which check if a service is still running on the Windows 2000 system.
I have created the following .bat for this:


@ECHO OFF
sc query NetXMSAgentdw32 | find "RUNNING"
sc query NetXMSAgentdw32 | find "STOPPED"


and the .bat file returns the following:
STATE : 4 RUNNING

I would like to have this value to be returned in our NetXMS server so that I can set alarm thresholds.
I have changed the nxagentd.conf as follow:

ExternalParameter=Test:"Start C:\PROGRA~1\Scripts\test.bat"

Then I added the test to our Data Collection Configuration (See attachment).
But this returns an ERROR (See other attachment).
We would like / expect to have the result from the Batch inside of the Value so that we can set thresholds on this value.


Normally we use Powershell which works perfect. But we can't use that on the Windows 2000 systems since they don't support Powershell..


Is there a way to get the result from the .bat into our value field / did I make any mistakes in the nxagentd.conf?


-Mitch

Filipp Sudanov

ExternalParameter is able to search in path, but requires exact executable name with extension. On the contrary, ExternalParameterShellExec calls shell and shell is able to find an executable even without extension (but I am not sure, if it is present in 1.0.13).

MitchW

Hi Filipp,

I don't think the ExternalParameterShellExec is compatible with Windows 2000. As soon as I add this to my agent config, the Server shows: Error
However the ExternalParameter should work as it is right now or not? Because the full path to the .bat file is mentioned in the config.

Filipp Sudanov

The thing is that the .bat file is not an executable as such, it's being executed by cmd.exe. And ExternalParameter needs an actual executable.
Running cmd.exe /C <your_bat_file> should probably to the job.

MitchW

This did the trick!

I changed my config to: ExternalParameter=Test:"cmd.exe "/C C:\PROGRA~1\Scripts\test.bat"" and now I have the result in my NetXMS Server :)


Thanks!