ZABBIX Forums  

Go Back   ZABBIX Forums > Zabbix Discussions and Feedback > Zabbix Cookbook

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2013, 22:04
RedShift RedShift is offline
Junior Member
 
Join Date: Sep 2009
Posts: 8
Default Monitoring Windows 2008, 2008R2, 2012 server backups

* This method is based on active checks. This means the monitored computer will contact the Zabbix server on its own to report the backup status. Make sure your infrastructure is set up to work with active checks!
* It works with the Windows task scheduler. When certain events occur in the backup log, this gets sent to Zabbix server using zabbix_sender.


1) Install the AgentTrapper.WindowsBackup template (ZabbixTemplate - AgentTrapper.WindowsBackup.xml)

This will create a template named "AgentTrapper.WindowsBackup". In this template there are two items:

* winbackup.status (Backup status): this can be either "Running" or "Finished successfully"
* winbackup.lasterror (Last backup, anomoly occurred on):
-> Value is 0: no errors have occurred since last backup has been started
-> Value is a date: the date and time when a warning or error has occurred.
-> This item is reset to 0 every time a new backup starts.

There are three triggers:
* A backup anomoly was logged during the last backup: goes off when a warning or error occurred during the last backup
* A backup has completed successfully: goes off when a backup has been completed successfully (informational).
* No backup status reported in last 48 hours: goes off when the winbackup.status hasn't been updated in the last 48 hours. If you're not making daily backups, you might want to adjust this threshold.


2) Installing the scheduled tasks

I've exported the scheduled tasks to XML files so you can use the task scheduler to import them. There are three scheduled tasks to be added:

* ZabbixAgent_BackupStarted.xml
-> Runs when a backup starts
-> Sets the winbackup.status item to "Running".
-> Resets the winbackup.lasterror key to "0".

* ZabbixAgent_BackupCompleted.xml
-> Runs when a backup has finished successfully
-> This task sets the winbackup.status item to "Finished successfully"

* ZabbixAgent_BackupAttention.xml
-> Runs when a warning, error or critical error occurs
-> This task sets the winbackup.lasterror to the current date and time

IMPORTANT
You will have to modify the XML files yourself before you import them. More specifically, the paths to zabbix_sender and its configuration file has to be adjusted to your situation. The XML files were made for my setups so adjust as

necessary.

Open the XML files and look at the <Actions> section:

Code:
  <Actions Context="Author">
    <Exec>
      <Command>cmd.exe</Command>
      <Arguments>/E:ON /C ""%ProgramFiles%\Zabbix\Agent\zabbix_sender" -c %ProgramData%\Zabbix\Agent\zabbix_agentd.conf -k winbackup.lasterror -o "%Date% %Time%""</Arguments>
    </Exec>
  </Actions>
If your zabbix_sender was installed under D:\ and your configfile D:\zabbix_agent.conf, you'd put in this:

Code:
  <Actions Context="Author">
    <Exec>
      <Command>cmd.exe</Command>
      <Arguments>/E:ON /C ""D:\zabbix_sender" -c D:\zabbix_agent.conf -k winbackup.lasterror -o "%Date% %Time%""</Arguments>
    </Exec>
  </Actions>
Please pay careful attention to these commands and triple check the quoting is correct!

3) Link your template to your host and test

That should be it.
Attached Files
File Type: xml ZabbixTemplate - AgentTrapper.WindowsBackup.xml (5.1 KB, 1012 views)
File Type: xml ZabbixAgent_BackupAttention.xml (3.6 KB, 857 views)
File Type: xml ZabbixAgent_BackupCompleted.xml (3.6 KB, 803 views)
File Type: xml ZabbixAgent_BackupStarted.xml (4.0 KB, 818 views)
Reply With Quote
  #2  
Old 24-01-2014, 20:22
TheFixer TheFixer is offline
Junior Member
 
Join Date: Jan 2014
Location: Juneau, Alaska
Posts: 2
Send a message via Skype™ to TheFixer
Default

Ok, what am I doing wrong....

Followed the instructions, the only change I made was in the Zabbix template, and I changed the type from Trapper to Zabbix agent (Active) as all the servers I scan are setup in Active mode.

The completion notification and running notification work work (I get "Backup Completed Successfully" and "Backup Running") however....

The Events are coming back to the Zabbix server as Problems, and also even if a backup completes successfully (No Errors) I will still get an anomaly notification.

Any ideas?
Reply With Quote
  #3  
Old 24-11-2014, 12:34
mulbzh mulbzh is offline
Member
 
Join Date: Nov 2014
Posts: 97
Default

it seems good, just be careful of commands path

Last edited by mulbzh; 24-11-2014 at 17:51.
Reply With Quote
  #4  
Old 12-01-2015, 13:47
devilkin devilkin is offline
Junior Member
 
Join Date: Jan 2015
Posts: 5
Default

Quote:
Originally Posted by TheFixer View Post
Ok, what am I doing wrong....

Followed the instructions, the only change I made was in the Zabbix template, and I changed the type from Trapper to Zabbix agent (Active) as all the servers I scan are setup in Active mode.

The completion notification and running notification work work (I get "Backup Completed Successfully" and "Backup Running") however....

The Events are coming back to the Zabbix server as Problems, and also even if a backup completes successfully (No Errors) I will still get an anomaly notification.

Any ideas?

Sorry to resurrect and old thread,

I encountered the same issue that you are having and made a small change to the template given here.

This is what I did:
  • Edited the trigger A backup has completed successfully
  • Changed the expression to {AgentTrapper.WindowsBackup:winbackup.status.str(R unning)}=1

This way it will fire the trigger (and create a problem event) when the backup starts and not when it completes successfully. Once the backup completes and returns "successfull" the trigger will fail, the problem state will go away and you will see green in the dash/overview
Reply With Quote
  #5  
Old 15-08-2016, 23:42
cesaralvaro cesaralvaro is offline
Junior Member
 
Join Date: Nov 2013
Posts: 2
Default Restart tread

Hi all!
Sorry for restart tread.
In my case i receive only ( No backup status reported in last 48 hours).
But the last backup sucefully have make in less 24 hours.
Sorry for my english.
Reply With Quote
  #6  
Old 16-09-2016, 21:55
devilkin devilkin is offline
Junior Member
 
Join Date: Jan 2015
Posts: 5
Default

Give this a try. I based the trigger possibilities on the template in this thread but rewrote the monitoring to use active checks to read the server event logs. So you dont need to do any of the scheduled tasks.

If your zabbix agent is set correctly to do active checks all you need is to assign this template to your host.

You can edit the template name, its currently set to the naming convention for my company.
Attached Files
File Type: xml zbx_export_templates.xml (3.7 KB, 328 views)
Reply With Quote
  #7  
Old 29-09-2016, 12:57
vrosansys vrosansys is offline
Junior Member
 
Join Date: Jun 2016
Posts: 4
Default

Quote:
Originally Posted by devilkin View Post
Give this a try. I based the trigger possibilities on the template in this thread but rewrote the monitoring to use active checks to read the server event logs. So you dont need to do any of the scheduled tasks.

If your zabbix agent is set correctly to do active checks all you need is to assign this template to your host.

You can edit the template name, its currently set to the naming convention for my company.
Good, thanks it's worked for me!
Reply With Quote
  #8  
Old 25-10-2016, 11:41
devilkin devilkin is offline
Junior Member
 
Join Date: Jan 2015
Posts: 5
Default

EDIT: ignore this

Last edited by devilkin; 26-10-2016 at 00:35. Reason: posted a reply that doesnt work.......
Reply With Quote
  #9  
Old 02-11-2016, 17:38
devilkin devilkin is offline
Junior Member
 
Join Date: Jan 2015
Posts: 5
Default New version

I picked up a problem on my template where in some occasions it doesnt report on a failure. Basically what happens is even after a failure windows still writes a non-critical log to say completed so this caused my solution to think everything is fine.

The new version checks the last 2 log entries for the keyword "failed" and also a dependency to not have this trigger fire if a backup is currently in progress (in which case there will also be two log entries in a row without "failure")
Attached Files
File Type: xml server backup zabbix.xml (4.3 KB, 372 views)
Reply With Quote
  #10  
Old 22-10-2017, 15:17
Gijs007 Gijs007 is offline
Junior Member
 
Join Date: Oct 2017
Posts: 16
Default

I'm using this script and it works great for monitoring backups.

I've noticed that the backup is running trigger is only triggered at the start of the backup. Is it possible to make it last while the backup is running or add a delay before it "untriggers"?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:42.