Ad Widget

Collapse

Monitoring robocopy job

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PiotrIr
    Member
    • Jun 2013
    • 45

    #1

    Monitoring robocopy job

    I’m looking for way to monitor robocopy job results running as a task on windows server and just wander if somebody could advise me something.
  • Smersh
    Member
    • Jul 2013
    • 49

    #2
    If it starts in cmd batch file, you can add the following in top of your cmd-batch:
    Code:
    @echo off
    
    set "logfile=[COLOR="blue"][I]<path_to_log_file>[/I][/COLOR]"
    
    [COLOR="blue"][I]rem This will restart batch itself with redirected STDIN and STDERR to log file.[/I][/COLOR]
    if NOT "%1" == "restarted" (
    	cmd /C "%~f0" restarted > "%logfile%" 2>&1
    )
    
    [I][COLOR="blue"]<your instructions here>[/COLOR][/I]

    Comment

    • PiotrIr
      Member
      • Jun 2013
      • 45

      #3
      Smersh,

      Thank you fro your reply.

      Unfortunately I'm not as experienced as you so not quite sure what I should do with the code. I've added it to begin of coping script but it looks nothing happen so:
      logfile=<path_to_log_file> - is it path for zabbix agent log folder?
      How to create trigger for this?
      Could you give me more details how it works and how to log success or failure?

      Comment

      • Smersh
        Member
        • Jul 2013
        • 49

        #4
        Scheduler job has exit code 0 if successful and other (or only 1?) if not. If it only what you want to monitor then you can use item like this:
        Code:
        eventlog[Microsoft-Windows-TaskScheduler/Operational,[B][COLOR="blue"]\"\\name_of_job\"[/COLOR][/B],,TaskScheduler,^201$,,skip]
        In the above code, color marked path to job in Microsoft Task Sheduler (windows 7/2008 and possible above). The highest is "\". Next comes "\Microsoft\", etc. Text of the event getting by above item is similar to: Task Scheduler successfully completed task "\name_of_job" , instance "{some_CLSID_here}" , action "C:\Windows\system32\Robocopy.exe" with return code 1.
        For monitoring, you can use trigger like this:
        Code:
        {hostname:eventlog[Microsoft-Windows-TaskScheduler/Operational,\"\\name_of_job\",,TaskScheduler,^201$,,skip].regexp(with return code 0\.$)}=0
        that mean not with return code 0.

        P.S. My previous post is not for monitoring by zabbix...
        Last edited by Smersh; 02-09-2014, 19:16.

        Comment

        • PiotrIr
          Member
          • Jun 2013
          • 45

          #5
          Thank you Smersh

          Comment

          • angelhc
            Senior Member
            Zabbix Certified Specialist
            • Nov 2009
            • 226

            #6
            Hi!
            You can use the zabbix_sender too on the same .bat file redirecting the result to a character variable. I thinks is easier and faster than the log monitoring.
            Regards.
            Number of hosts 1600,Number of items +90k,Number of triggers +22k, Number of users +100, New values per second +1270

            http://zabbixes.wordpress.com/

            Comment

            • Garry Brown
              Junior Member
              • Jan 2018
              • 1

              #7
              Long Path Tool

              I would like to suggest you, try Long Path Tool program to resolve this issue.

              Comment

              Working...