New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Powershell script gives continuously value null

Votes:

0

Your Vote:

Up

Down

We have defined a own sensor which is based on a script with a XML output. Still PRTG returns the value 0 all the time. If we executed our Powerschell script on the server we receive the value 61

OUTPUT Script: <prtg> <result> <channel> UsedMemory_GB </channel> <value> 61 </value> <mode>Absolute</mode> </result> </prtg>

Can anyone see the error? The value 61 is integer.

custom-sensor powershell prtg script

Created on Oct 1, 2018 2:33:04 PM by  pcusters (50) 2 1



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

We found the solution. Everything in PRTG must be 32-bit. We used PS and DLL of 64-bit quality. After changing this to 32-bit it worked fine.

Created on Oct 3, 2018 12:23:21 PM by  pcusters (50) 2 1



8 Replies

Votes:

0

Your Vote:

Up

Down

Could you post the entire script? Remember to remove any security relevant information.


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Oct 1, 2018 3:24:11 PM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Param(

[string]$HanaAdminUserName,
[string]$HanaAdminPassword,
[string]$HanaHostPort
)


$ConnectionString = "server=" + $HanaHostPort + ";UserID=" + $HanaAdminUserName + ";Password=" + $HanaAdminPassword 
#************ Set Your Connection String Parameters here ****************
# Check out http://www.connectionstrings.com/ or http://www.w3schools.com/ADO/default.asp for help on ADO

# Sample for Microsoft Access Database
# $myconnectionstring = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = c:\test\sample.mdb"

# Sample for MS SQL Server
# $myconnectionstring = "Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=test;Initial Catalog=yourname;Data Source=10.1.4.105\SQLEXPRESS"
    
#add-type -path "C:\Program Files\sap\hdbclient\ado.net\v4.5\Sap.Data.Hana.v4.5.dll"
        

#$myconnectionstring = $dsn

         
         

#************ Set Your SQL Statement Parameters here ****************
# The script assumes that your database contains the table 'employees' with the field 'salary'.
# According to the Database you may have to adjust the SQL statement.
#Add-type -path "C:\Program Files\sap\hdbclient\ado.net\v4.5\Sap.Data.Hana.v4.5.dll"
Set Culture en-US
$myHDBQuery1 =  "select 
case when count(*) is not null then count(*)
else '0' end as delayed_jobs
from SAPABAP2.TBTCO
where STATUS = 'D'"

$mytablecolumnname1="Delayed Jobs"

 $Connection = New-Object Sap.Data.Hana.HanaConnection
 $Connection.ConnectionString = $connectionstring
 $Connection.Open()

 $Command = New-Object Sap.Data.Hana.HanaCommand($myHDBQuery1, $Connection)
	$ds=New-Object system.Data.DataSet
	$da=New-Object Sap.Data.Hana.HanaDataAdapter($Command)
	[void]$da.fill($ds)
 $Connection.Close()
 $QueryResponse = $ds.Tables  | Select-Object -Expand Rows  
 
$A = $QueryResponse[0]-as[int]

# return the result
write-output "<prtg>"
Write-Output "	<result>"
Write-Output "		<channel>Delayed Jobs</channel>"
Write-Output "		<value>"$A "</value>"
Write-Output "		<float>1</float>"
Write-Output "	</result>"
Write-Output "<Text>OK</Text>"
Write-Output "</prtg>"

Created on Oct 2, 2018 8:10:34 AM by  pcusters (50) 2 1

Last change on Oct 3, 2018 1:10:52 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thanks for that. Did you already enable "Use credentials of parent device" in the security context of the sensor?


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Oct 2, 2018 9:36:13 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

The option: "Use Windows credentials of parent device" is selected

Created on Oct 2, 2018 10:03:43 AM by  pcusters (50) 2 1



Votes:

0

Your Vote:

Up

Down

Does the user you're using in the device have that very module installed? What speaks against using ODBC, as in the upper part of the script?


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Oct 2, 2018 11:39:06 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

We don't understand the question are you proposing? During executing of the script in PS we don't get any error's about ODBC.

Created on Oct 2, 2018 12:19:01 PM by  pcusters (50) 2 1



Votes:

0

Your Vote:

Up

Down

Sorry if my previous reply was ambiguous. Could you please enable the Write Result To Disk option in the sensor settings, locate them in C:\ProgramData\Paessler\PRTG Network Monitor\Logs\Sensors and send them to us via support@paessler.com, referring to this thread? Thanks! :)


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Oct 2, 2018 1:10:33 PM by  Stephan Linke [Paessler Support]



Accepted Answer

Votes:

0

Your Vote:

Up

Down

We found the solution. Everything in PRTG must be 32-bit. We used PS and DLL of 64-bit quality. After changing this to 32-bit it worked fine.

Created on Oct 3, 2018 12:23:21 PM by  pcusters (50) 2 1



Please log in or register to enter your reply.


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.