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

Custom sensor show no value

Votes:

0

Hi everyone.

I have a problem with a custom sensor I made.

Here the code: {{{$trace = Invoke-Command -ComputerName gp-vm-ctxburo01 -ScriptBlock {

qfarm /load gp-vm-ctxburo01

}

$a=$trace[3] $b=$a.Substring(22) $c=[int]$b

Write-Host "<prtg>" Write-Host "<result>" Write-Host "<channel>Charge</channel>" Write-Host "<float>1</float>" Write-Host "<value>$c</value>" Write-Host "</result>" Write-Host "</prtg>"}}}

When I excute on my prtg server he show this result:

<prtg> <result> <channel>Charge</channel> <float>1</float> <value>1600</value> </result> </prtg>

But on my sensor, he show me on the last value 0.

I don't understand why.

Can someone help me ?

I'm not very good with powershell and sorry for my bad english.

custom-script-exe custom-sensor powershell

Created on Oct 30, 2018 1:51:40 PM



4 Replies

Votes:

0

Dear LoisP,

in order to debug this, please open the sensor tab "Settings" and enable the "Write Exe result to disk" option. After the next sensor scan, logs should be written to "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)". One of the logs contains the raw output of the script as PRTG gets it. When you look into that, do you see a different result XML?

Created on Oct 30, 2018 9:12:26 PM by  Arne Seifert [Paessler Support]



Votes:

0

Thx you for the reply.

I have this error {{{[gp-vm-ctxburo01] La connexion au serveur distant gp-vm-ctxburo01 a ‚chou‚ avec le message d'erreur suivant: AccŠs refus‚. Pour plus d'informations, voir la rubrique d'aide about_Remote_Troubleshooting. + CategoryInfo : OpenError: (gp-vm-ctxburo01:String) [], PSRemoti ngTransportException + FullyQualifiedErrorId : AccessDenied,PSSessionStateBroken Indexation impossible dans un tableau Null. Au caractŠre C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\QFARM CTXBURO01.ps1:7 : 1 + $a=$trace[3] + ~~~~~~~~~~~ + CategoryInfo : InvalidOperation : (:) [], RuntimeException + FullyQualifiedErrorId : NullArray

Impossible d'appeler une m‚thode dans une expression Null. Au caractŠre C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\QFARM CTXBURO01.ps1:8 : 1 + $b=$a.Substring(22) + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation : (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull

Impossible d'appeler une m‚thode dans une expression Null. Au caractŠre C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\QFARM CTXBURO01.ps1:9 : 1 + $c=$b.Trim() + ~~~~~~~~~~~ + CategoryInfo : InvalidOperation : (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull

0:<prtg> <result> <channel>Charge</channel> <float>1</float> <value>30</value> </result> </prtg> }}}

I don't understand why my powershell doesn't work when prtg lauch it.

When i do it manuallly, he work fine.

Created on Oct 31, 2018 2:40:16 PM



Votes:

0

Dear LoisP,

in this case, please try this:

  • Change the sensor settings and use the other option for the "Security Context" setting. Please make sure that the sensor's parent device has the Windows right credentials set.
  • If you use parameters for the script, please note that arrays are not supported, but there is a solution available.
  • If it still does not work, please check your script using the 32-bit (x86) Powershell. Does the script run here?

Created on Oct 31, 2018 3:13:28 PM by  Arne Seifert [Paessler Support]

Last change on Oct 31, 2018 3:13:47 PM by  Arne Seifert [Paessler Support]



Votes:

0

Thx you for the reply. Its work now.

Created on Oct 31, 2018 4:15:06 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.