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


How to monitor robocopy logs with PRTG

Votes:

0

Your Vote:

Up

Down

In the company I work, we use the command Robocopy in a bat file with the Windows Task Scheduler to run some backups, every backup creates a log file with the name following the pattern: Full_"%date:/=_%".txt . I would like to know how is the best way to monitor the backups status.

backup prtg robocopy

Created on Aug 3, 2015 8:10:58 PM by  peresbr (0) 1



12 Replies

Votes:

8

Your Vote:

Up

Down

Hi

I think that depends on what you want to monitor. I use the folder sensor to check if there is a new file in a specific folder and check the age. I also use a filecontent sensor on a specific file to check if it has any string with "error" or "unsusccessful" in it.

I think the folder sensor would be ok for you. You can tell the sensor to check for file ages. But you have to move "older" logfiles to a subfolder. I would integrated a move command in the robocopy batch to move all old logfiles in to a subfolder before starting a new one. Then it is quite easy to manage with the folder sensor

Manual: Folder Sensor

regards Thomas

Created on Aug 4, 2015 6:54:47 AM by  Thomas Umbricht (2,820) 2 3

Last change on Aug 4, 2015 7:51:51 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thanks for your reply.

I'll add the folder sensor, but the file sensor I think will not be aplicable in my case, because the log's file name is variable, and I need to verify if the backup was successfull.

Created on Aug 4, 2015 3:58:07 PM by  peresbr (0) 1



Votes:

1

Your Vote:

Up

Down

The sensor can be turned into a Custom EXE/Script sensor that supports wildcards in the filename rather easily:

  1. Copy C:\Program Files (x86)\PRTG Network Monitor\Sensor System\LogfileReader.exe to the C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE directory.
  2. Create a new EXE/Script sensor using the LogfileReader.exe. Set the parameters like this:
    -f="C:\logs\robocopy*.log" -s="asn1telinitialisatiebevestiging" -id=%sensorid -t
  3. Make sure the path to the logfile is correct and save the sensor
  4. Click the small gear in the value channel, enable limites, and set them like this:
    • Upper warning limit: 0
    • Upper error limit: 1
  5. Save

Note that you can also use -r instead of -s and use regular expressions for searching. The sensor will go into a down state if the string is found initially for one scanning interval. After one scanning interval it will be in a warning state. This means that the string exists in the file, but there hasn't been a new one since the last scanning. It will go into a down state once there's a new occurence.

Created on Aug 4, 2015 5:43:44 PM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thanks for the feedback, Stephan.

I did as you told, but it didnt work.

It follows an screenshot: https://lh3.googleusercontent.com/e3KUOy-HpVjA5KzLkofFOda8ecuOwkKjdW4h42RsdSQ=w1372-h979-no

I used the -r parameter as you told.

What did I did wrong?

Created on Aug 13, 2015 6:55:22 PM by  peresbr (0) 1



Votes:

0

Your Vote:

Up

Down

Could you try using C:\Backup\Log\*.txt as path?

Created on Aug 14, 2015 10:15:43 AM by  Stephan Linke [Paessler Support]




Votes:

0

Your Vote:

Up

Down

I think you set the limits in the wrong channel. Not the xecution time is supposed to have limits, it's the value channel that's important. The sensor should turn green when you remove the limit from the execution time channel :)

Created on Aug 17, 2015 11:40:21 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Well, I removed the limit but is still alarming. There is only 2 channels: Execution Time and Downtiime:

https://lh3.googleusercontent.com/BLspsyoVrYHkTGIwAUayg8HKwFD99QjC3p8102DmKm4=w1540-h353-no

Created on Aug 17, 2015 2:39:14 PM by  peresbr (0) 1



Votes:

0

Your Vote:

Up

Down

Is that folder located on the PRTG server or a monitored server? If its the latter, you'll have to use UNC paths instead of local paths for the f parameter.

Created on Aug 18, 2015 8:31:45 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Of course, I dont know how I didnt think it before!

It worked. Thank you!

Created on Aug 18, 2015 1:27:03 PM by  peresbr (0) 1



Votes:

0

Your Vote:

Up

Down

Phew, that was my last resort :D Glad it works now :)

Created on Aug 18, 2015 5:44:10 PM by  Stephan Linke [Paessler Support]



Votes:

9

Your Vote:

Up

Down

This script works for me:

$logFile_path = "[myLogFile].log"

#write-host $content[1] -b Yellow

# 10 last lines
$content = gc $logFile_path -tail 10

# split with pregmatch whitespace
$dir = $content[1] -split "\s+"

# value directory mismatch and error
$mismatch_dir = $dir[6]
$failed_dir = $dir[7] 

# value files mismatch and error
$file = $content[2] -split "\s+"
$mismatch_file = $file[6]
$failed_file = $file[7]


$result= "<?xml version=`"1.0`" encoding=`"Windows-1252`" ?>`r`n"
$result+="<prtg>`r`n"

$result+="   <result>`r`n"   
$result+="        <channel>Mismatch File</channel>`r`n"
$result+="       <Unit>Count</Unit>`r`n"
$result+="       <value>$mismatch_file</value>`r`n"
$result+="   </result>`r`n"

$result+="   <result>`r`n"   
$result+="        <channel>Mismatch Directory</channel>`r`n"
$result+="       <Unit>Count</Unit>`r`n"
$result+="       <value>$mismatch_dir</value>`r`n"
$result+="   </result>`r`n"

$result+="   <result>`r`n"   
$result+="        <channel>Failed File</channel>`r`n"
$result+="       <Unit>Count</Unit>`r`n"
$result+="       <value>$failed_file</value>`r`n"
$result+="   </result>`r`n"

$result+="   <result>`r`n"   
$result+="        <channel>Failed Directory</channel>`r`n"
$result+="       <Unit>Count</Unit>`r`n"
$result+="       <value>$failed_dir</value>`r`n"
$result+="   </result>`r`n"

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

Created on Jun 8, 2016 5:11:29 AM by  Yann (300) 1 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.