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


size of single multiple files in one sensor possible?

Votes:

0

Your Vote:

Up

Down

Hello,

Is there a skript out there where you can put multiple files in one sensor? The prtg filesensor only can show one file per sensor. I have 20 Database files and want to see the grow of each file in a graph, but dont want make one sensor for every one. There would be although a disadvantage by the adding and removing of a file. I can group them (e.g 5 files to one group etc.)

Thanks

file-monitoring files snmp-sensor

Created on Aug 3, 2018 9:49:19 AM by  networker-KM (0) 1



2 Replies

Accepted Answer

Votes:

5

Your Vote:

Up

Down

Hi,

You could simply write a VBScript to accomplish this. See below, this is pretty variable and allows you to accomplish this.

'Execute:
'Argument 0 = amount of files
'Argument 1 to x = file-path in ""
'CheckMultipleFileSizes.vbs 2 "C:\path\file" "\\server\share\path\file"

Dim iFiles
Dim strPaths
Dim cnt

If WScript.Arguments.Count > 1 Then
	iFiles = WScript.Arguments.Item(0)
	For cnt = 1 To iFiles
		If Len(strPaths) > 0 Then
			strPaths = strPaths & "|&|"
		End If
		strPaths = strPaths & WScript.Arguments.Item(cnt)
	Next
Else
	Wscript.Echo "Usage: cscript CheckMultipleFileSizes.vbs 2 ""C:\path\file"" ""\\server\share\path\file"""
	Wscript.Quit
End If
 
Dim fs
Dim objFile
 
Dim strPathTemp

WScript.echo "<prtg>"
Set fs = CreateObject("Scripting.FileSystemObject")
	strPathTemp = Split(strPaths,"|&|")
	For cnt = 0 To UBound(strPathTemp)
		If fs.FileExists(strPathTemp(cnt)) Then
			Set objFile = fs.GetFile(strPathTemp(cnt))
			WScript.echo "<result>"
			WScript.echo "<channel>" & objFile.Name & "</channel><value>" & objFile.Size & "</value>"
			WScript.echo "</result>"
		End If
	Next
Set fs = Nothing
WScript.echo "</prtg>"

Will post this as well on my personal blog since it seems to be a valuable and pretty variable sensor.

Regards

Florian Rossmark

www.it-admins.com

EDIT: changed line 13 form If Len(strPath) > 0 Then to If Len(strPaths) > 0 Then

Created on Aug 3, 2018 6:42:27 PM by  Florian Rossmark (4,110) 3 2

Last change on Aug 6, 2018 4:24:39 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thank you for sharing your script, Florian.

Kind regards,

Erhard

Created on Aug 6, 2018 11:14:55 AM by  Erhard Mikulik [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.