What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Test TCP/UDP ports from one client to another

Votes:

0

I need to verify that some TCP/UDP ports are open. As a source I have a client and as a destination I have another one. The sensor used is Custom EXE/Script Sensor. The EXE file to connect to the source client is PsExec of Windows Sysinternals and the port scanner (copied to the client) is PortQry from Microsoft download center. Setting of the sensor:

EXE/Script: PsExec.exe

Parameters: \\x.x.x.x -nobanner cmd /c "C:\Temp\PortQry.exe -n x.x.x.x -e portxxxx -nr -q"

the result is always: Response not well-formed: "( ■S

launched by console the result is (Ok): cmd exited on x.x.x.x with error code 0.

launched by console the result is (Fail): cmd exited on x.x.x.x with error code 1.

How can I read it in the sensor correctly?

Thanks

custom-sensor port portqry psexec

Created on Mar 9, 2018 4:37:58 PM



5 Replies

Votes:

0

I don't have much experience with script sensors, but can't you just set limits on the "value" channel of the script ? As it checks the return value of the script, set the upper and lower limit to 0 so that non-zero value returns an error ?

Created on Apr 20, 2018 8:54:52 AM



Votes:

0

Hi there,

Please activate the "Write EXE result to disk" option in the sensor's settings and post the log files (Result of Sensor XXX.Data.txt and Result of Sensor XXX.txt) located on the corresponding probe under "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)".

Best regards.

Created on Apr 20, 2018 12:16:37 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hi Andrea, I had similar issue on a VB script. The reason is the syntax expected to be returned by the script sensor.
The return value should be like "<value> : <message>".

I had a short test without teh PSExec and could handle it like this:

"PortQry.exe -n <machineIPName> -e <port> -nr -q && ECHO 1 : Portscan succeeded || ECHO 0 : Portscan failed"

(Attention: you need first the succeeded ECHO case to be bound with "&&" and then the error case with "||")

In this case you get a 0 for success and -1 in case of a failure.
To use inline here directly the %errorlevel% variable is not working as it is not updated yet durign the execution. It always outline the former value. (Would need to execute it twice ;-) )

Alternative you just put your command in a script and then add a command line like this:

ECHO %errorlevel% : <any text>

With a prior condition you can also add a case dependant message text.

I hope this helps to come to your final solution.
Regards,
jo

Created on Apr 20, 2018 1:55:17 PM

Last change on Apr 20, 2018 4:34:49 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Are you able to use the PORT sensor? of course if you want to do this on a remote machine you need to install a probe.

If you want to do this on 100 machines then you might have an issue with probes, and doing as you are now might be a valid way.

Created on Apr 27, 2018 1:30:53 AM



Votes:

0

Hi, AndrewG, The machines I have to test are segregated by a firewall, so I have to run the test not from the probe but from the device itself to another.

Created on Jun 25, 2018 1:22:24 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.