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


Prtg does not get my xml output

Votes:

0

Your Vote:

Up

Down

Hi Guys,

I do not see what is not correct about this xml output...

This is the code in powershell :

#-----Please adjust to your Exchange server:
$CURI="http://myserver/PowerShell/"
#--------------

Function SizeInBytes ($itemSizeString)
{
    $posOpenParen = $itemSizeString.IndexOf("(") + 1
    $numCharsInSize = $itemSizeString.IndexOf(" bytes") - $posOpenParen 
    $SizeInBytes = $itemSizeString.SubString($posOpenParen,$numCharsInSize).Replace(",","")
	return $SizeInBytes 
}

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $CURI -Authentication Kerberos
Import-PSSession $Session -DisableNameChecking

$dbs = Get-MailboxDatabase -Status


$result+="<prtg>`r`n"

foreach($db in $dbs)
{
	$dbname=$db.name
	$dbsize=SizeInBytes($db.DatabaseSize)
	$whitespace=SizeInBytes($db.availablenewmailboxspace)

	$edbFilePath = ("\\"+$db.ServerName+"\"+ $db.EdbFilePath.tostring().replace(":","$"))
	$i = $edbFilePath.LastIndexOf('\')
	$edbFilePath = $edbFilePath.Remove($i+1)
	$guid = $db.Guid.ToString()
	$dir = (get-childitem $edbFilePath | where { $_.Name.Contains($guid) })
	$idxdir=$edbFilePath+$dir
	$idxsize=(Get-ChildItem $idxdir | Measure-Object -Property Length -Sum).Sum

	$result+="   <result>`r`n"
	$result+="       <channel>DB-Size "+$dbname+"</channel>`r`n"
	$result+="       <unit>BytesFile</unit>`r`n"
	$result+="       <value>"+$dbsize+"</value>`r`n"
	$result+="   </result>`r`n"
	$result+="   <result>`r`n"
	$result+="       <channel>Whitespace "+$dbname+"</channel>`r`n"
	$result+="       <unit>BytesFile</unit>`r`n"
	$result+="       <value>"+$whitespace+"</value>`r`n"
	$result+="   </result>`r`n"
	$result+="   <result>`r`n"
	$result+="       <channel>Size Index "+$dbname+"</channel>`r`n"
	$result+="       <unit>BytesFile</unit>`r`n"
	$result+="       <value>"+$idxsize+"</value>`r`n"
	$result+="   </result>`r`n"
}		

$result+="</prtg>`r`n"

$result

Exit 0

My result

PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Luktdit.ps1

ModuleType Version    Name                                ExportedCommands                                                                                                                    
---------- -------    ----                                ----------------                                                                                                                    
Script     1.0        tmp_0odkiko5.l0w                    {Add-ADPermission, Add-AvailabilityAddressSpace, Add-ContentFilterPhrase, Add-DatabaseAvailabilityGroupServer...}                   
<prtg>
   <result>
       <channel>DB-Size Mailbox Database 1820752587</channel>
       <unit>BytesFile</unit>
       <value>1072275456000</value>
   </result>
   <result>
       <channel>Whitespace Mailbox Database 1820752587</channel>
       <unit>BytesFile</unit>
       <value>24879923200</value>
   </result>
   <result>
       <channel>Size Index Mailbox Database 1820752587</channel>
       <unit>BytesFile</unit>
       <value>1072545885175</value>
   </result>
   <result>
       <channel>DB-Size TestDB</channel>
       <unit>BytesFile</unit>
       <value>114756157440</value>
   </result>
   <result>
       <channel>Whitespace TestDB</channel>
       <unit>BytesFile</unit>
       <value>108396544</value>
   </result>
   <result>
       <channel>Size Index TestDB</channel>
       <unit>BytesFile</unit>
       <value>114933014528</value>
   </result>
   <result>
       <channel>DB-Size NewUsers</channel>
       <unit>BytesFile</unit>
       <value>259981312</value>
   </result>
   <result>
       <channel>Whitespace NewUsers</channel>
       <unit>BytesFile</unit>
       <value>110428160</value>
   </result>
   <result>
       <channel>Size Index NewUsers</channel>
       <unit>BytesFile</unit>
       <value>259981312</value>
   </result>
</prtg>




PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> 

What am i doing wrong?

prtg whitespace xml-not-understand

Created on Nov 19, 2019 3:46:59 PM by  TheOneWhoMayNotBeNamed (0) 1

Last change on Nov 20, 2019 5:33:32 AM by  Sven Roggenhofer [Paessler Technical Support]



1 Reply

Votes:

0

Your Vote:

Up

Down

Hi,

I would ask you to take a look into the following link, as it could be possible that you're using the wrong sensor for this script.

Kind regards.

Created on Nov 20, 2019 2:22:08 PM by  Marijan Horsky [Paessler Support]



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.