PowerShell script exchange
Gav@GH
Influencer
Posts: 21
Liked: 15 times
Joined: Jul 20, 2012 12:27 am
Contact:

SysAdmin Modular Reporting (SAMReport) for Veeam

Post by Gav@GH » 13 people like this post

I'm just a regular Veeam user and love the product. A while back I came to this forum to find some information on some enhanced Powershell reporting. Things like a list of the results from all my jobs or a summary of storage free space and so on. There was a pretty good collection of posts, but there was no single report that meet my needs. I originally started to make one, but soon realised that in this environment of sharing and collaboration, there was no real point in developing a personal report as it would probably not suit anybody else. Our environments and requirements are all completely different.

So I went away and started to develop a series of individual scripts that could be added to or customised (by anyone) and then joined together to form a single report. I also wanted a quick way to alert me to anything that wasn't normal or outside a threshold. The project grew and grew to the point where I realised it wasn't just Veeam that this could be used for, but any system that used powershell. In the end it has become known as SysAdmin Modular Reporting or SAMReports for short. I've put up a whole post on it with links to source code on my blog http://www.theagreeablecow.com/2012/09/ ... ports.html

However, it all started here with Veeam! So I wanted you guys to be first to have a look. Currently there are eight child scripts for Veeam, which report on the following:

- Veeam_Get-JobStatusSummary.ps1 (Summary of the most recent session for all jobs)
- Veeam_Get-JobStatusDetails.ps1 (Details of the most recent session for all jobs)
- Veeam_Get-BackupStorageStatus.ps1 (Storage data and any alerts for Veeam Backup repositories)
- Veeam_Get-ReplicaStorageStatus.ps1 (Storage data and any alerts for Veeam Replica repositories)
- Veeam_Get-AllUnprotectedVMs.ps1 (Checks vCenter for any machines not protected)
- Veeam_Get-ServicesStatus.ps1 (Checks the current Status of Veeam Services)
- Veeam_Get-LicenseStatus.ps1 (Checks the licensing status and expiration period)
- Veeam_Gent-EventLogs.ps1 (Gathers event logs based on specified queries)

The whole project is very much open source, so I would love to get some feedback or even better some plugins! Anything submitted will be fully acknowledged and then shared for others to use.

Here is a sample of the output

Image

Cheers,

Gav
Gostev
Chief Product Officer
Posts: 31457
Liked: 6647 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by Gostev »

Incredible report. Thank you so much for sharing!
tsightler
VP, Product Management
Posts: 6009
Liked: 2842 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by tsightler »

These scripts are absolutely amazing. Excellent work!
Gav@GH
Influencer
Posts: 21
Liked: 15 times
Joined: Jul 20, 2012 12:27 am
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by Gav@GH »

Thanks Tom,

Credit to you too for the "get-unprotectedVMs" base code. This initial problem and your script is pretty much where it all started!

I hade some anomalies in the results using just VBR calls, so ended up going back to comparing using the vcenter plugin.
Gav@GH
Influencer
Posts: 21
Liked: 15 times
Joined: Jul 20, 2012 12:27 am
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by Gav@GH » 1 person likes this post

For those that have upgraded to Veeam version 6.5, you make find that it broke the Veeam powershell plugins.

The quick fix is to run "C:\Program Files\Veeam\Backup and Replication\Install-VeeamToolkit.ps1", which installs the .Net4 configuration files for powershell V2.
alex.nunley
Influencer
Posts: 19
Liked: never
Joined: Jan 18, 2013 3:36 pm
Full Name: Alex Nunley
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by alex.nunley »

I was wondering if you could provide any guidance about running these reports from a remote client.


Very useful, and due cheers!
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by Vitaliy S. »

I'm not a PowerShell expert, but can't you run this report via PowerShell remoting?
organic.dog
Novice
Posts: 5
Liked: never
Joined: Feb 21, 2013 12:13 pm
Full Name: martin campbell
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by organic.dog »

Hello, this is a very useful script - thanks.

I was wondering if there was any way to make Veeam_Get-JobStatusSummary to run across multiple veeam servers, i.e. to use $serverarray from the global variables? This would allow me to have a single email report for the multiple Veeam instances.
I'm not sure if it's already there and I am missing something ...


Once again, thanks for the hard work & the script!
organic.dog
Novice
Posts: 5
Liked: never
Joined: Feb 21, 2013 12:13 pm
Full Name: martin campbell
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by organic.dog »

To expand, what I am looking to do is to make the section that denotes VMs currently not protected by Veeam more useful when there are multiple instances.
As with multiple Veeam instances (one per datacenter for us) that means that Veeam Server A sees all VMs it doesn't backup and triggers alerts, however Veeam Server B may well back them up. So attempting to merge the multiple servers into a holistic view appears to be complex..

Enterprise Manager has this holistic view, but i don't know if we can run powershell against Enterprise Manager - anyone?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by veremin »

Enterprise Manager has this holistic view, but i don't know if we can run powershell against Enterprise Manager - anyone?
As far as I’m concerned, nothing like this can be done by you. Seems like some modifications to existing script are required in order to meet your expectations.

Hope this helps.
Thanks.
organic.dog
Novice
Posts: 5
Liked: never
Joined: Feb 21, 2013 12:13 pm
Full Name: martin campbell
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by organic.dog »

I feared that :(

I'm afraid my powershell skills fall far short of the authors, so I think adapting the script will be beyond me...
tsightler
VP, Product Management
Posts: 6009
Liked: 2842 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by tsightler »

The biggest challenge is, to run reports from multiple Veeam servers would require Powershell remoting to gather the information from the various Veeam servers. This shouldn't be too difficult to adapt to the current scripts, I've just never taken the time.

You might consider using one of the other scripts that report on unprotected VMs based on parsing the attributes (assumes Veeam is configured to update either the "notes" attribute or some custom attribute of the VM on job completion). This allows for reporting based only on VM state and doesn't require any access to the Veeam servers at all.
organic.dog
Novice
Posts: 5
Liked: never
Joined: Feb 21, 2013 12:13 pm
Full Name: martin campbell
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by organic.dog »

an interesting idea, I had originally looked at doing something like that with the "notes" field but bumped into the issue that some VMs, but not others, in our deployment use the notes field for other relevant information. I got the impression from Veeam that it would obliterate the existing "notes". I hadn't considered using a custom field..

ta
tsightler
VP, Product Management
Posts: 6009
Liked: 2842 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by tsightler »

Yep, you can create a custom attribute, many customers use "Backup Status" or something similar. Then you can report on this field. I wrote my report not to depend on this field because some customers simply didn't want to use a custom attribute, and because I visit a lot of clients and wanted to be able to run the report right away, without requiring any changes to the environment, but if updating a custom attribute is option for you then this may be easier since you have multiple Veeam servers.

The script itself wouldn't have to do anything but pull in all of the VMs, grab the custom attribute and parse out of it's either missing, or hasn't been recently updated. I think there might be an example of a script that does this somewhere on the forum already.
organic.dog
Novice
Posts: 5
Liked: never
Joined: Feb 21, 2013 12:13 pm
Full Name: martin campbell
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by organic.dog »

thanks! I have been looking into setting the custom attribute already, looks like it will do the trick.

A quick look around the forum seems to turn up a script by your kind self doing something similar :)
I guess most of this is now demoted to the back of the queue behind Veeam One. Maybe I should be asking for pricing on that..
benrpatterson
Novice
Posts: 4
Liked: never
Joined: Aug 29, 2014 7:38 am
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by benrpatterson »

This is really really useful, thank you :D

If I want to run the Get-JobStatusSummary for a certain period of time, is it possible?

Is there a list of modules that others have also created for this script?

Many thanks
BP
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by veremin »

I've taken a brief look at source code and it seems that Get-JobStatusSummary takes only the latest sessions ($Session = $Job.FindLastSession()). If you want to get sessions from a certain period of time, you will have to modify that variable. Thanks.
benrpatterson
Novice
Posts: 4
Liked: never
Joined: Aug 29, 2014 7:38 am
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by benrpatterson »

Thanks Vladimir,

I'm pretty useless on the scripting. How could i amend that variable please? I was looking for something like, between 2 dates, get those job details.

$Session = $Job.FindLastSession()

Thanks,
Ben
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by veremin »

Hi Ben,

In order to get backup sessions occurred between certain dates, you will have to write something like the following:

Code: Select all

$Date1 = Get-Date -Date "datetime"
$Date2 = Get-Date -Date "datetime"
$Session = Get-VBRBackupSession | where {($_.Jobname -eq $Job.Name)-and ($_.endtime -ge $Date1) -and ($_.endtime -le $Date2)}
However, be aware that the original code is written for and supposed to work with only one session, so, I'm not sure whether passing array of sessions, instead of single one, would cause any effect on the script.

Thanks.
benrpatterson
Novice
Posts: 4
Liked: never
Joined: Aug 29, 2014 7:38 am
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by benrpatterson »

Thanks Vladimir,

I tested it and it runs, however I'm not sure sure on the numbers. The dates and time below are the start and end time of all our backup and replication jobs.

Is $Job related to group or a VM?

From the Enterprise Manager I can see
Total job runs:29
Successes:13
Warnings:6
Errors:10

From the script i can see
Total Jobs: 701
Success 593
Pending 0
Warning 35
Failed: 71
Unknown: 2

Code: Select all

$Date1 = Get-Date -Date "01AUG2014 17:30"
$Date2 = Get-Date -Date "02AUG2014 08:00"
$Session = Get-VBRBackupSession | where {($_.Jobname -eq $Job.Name)-and ($_.endtime -ge $Date1) -and ($_.endtime -le $Date2)}
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by veremin »

benrpatterson wrote:Is $Job related to group or a VM?
It's related to one job.
benrpatterson wrote:From the script i can see
The reason of such inconsistency might be the fact that the script originally has accepted only single session, and now you're trying to pass an array of those to it. "Total Jobs:" seems to be calculated as number of VMs processed during the specified period of time.

Thanks.
joabec
Lurker
Posts: 2
Liked: never
Joined: Jan 20, 2015 10:31 am
Full Name: Joakim
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by joabec »

Hi,
I'm trying to get a report presenting how much space each backup job takes, not how much space is avalible on the respitory but I can't figure out how to rewrite the Get-BackupStorageStatus.ps1 script to fetch that information. any help will be much appreciated.

Cheers
JB
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by veremin » 1 person likes this post

Are you using Windows-based repository? If so, you can use just MS PS in order to get a folder size, since one backup or backup copy job occupies one folder at the target storage:

Code: Select all

$Size = Get-ChildItem 'Path to your backup job' | Measure-Object -property length -sum 
$Size.sum /1mb
Thanks.
joabec
Lurker
Posts: 2
Liked: never
Joined: Jan 20, 2015 10:31 am
Full Name: Joakim
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by joabec »

Thanks v.Eremin
That will do it :-)

Thanks
JB
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by veremin »

You're welcome. If additional assistance is required, let me know. Thanks.
pearlfusion
Lurker
Posts: 1
Liked: never
Joined: Dec 16, 2015 1:49 pm
Full Name: BOURDON Florian
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by pearlfusion »

Hello,

it's possible to exclude type backup called "BackupSync" in module "Get-JobStatusDetails" ??

Thanks a lot.
nullifi
Influencer
Posts: 23
Liked: 5 times
Joined: Aug 05, 2015 1:41 pm
Full Name: Jason Taylor
Contact:

[MERGED] : Scheduled script report similar to vCheck?

Post by nullifi »

I remember reading about some scheduled task email report script that is similar to vCheck, but not dedicated to VMware exclusively.

I swear I saw it mentioned on these forums somewhere, I thought it was something like sysadm or sys..something.. s, something? Anyone know what I'm talking about?
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Scheduled script report similar to vCheck?

Post by PTide »

Hi,

Are you talking about report provided above?
nullifi
Influencer
Posts: 23
Liked: 5 times
Joined: Aug 05, 2015 1:41 pm
Full Name: Jason Taylor
Contact:

Re: Scheduled script report similar to vCheck?

Post by nullifi »

That was it, thank you!
Ctek
Service Provider
Posts: 83
Liked: 13 times
Joined: Nov 11, 2015 3:50 pm
Location: Canada
Contact:

Re: SysAdmin Modular Reporting (SAMReport) for Veeam

Post by Ctek »

Is this SAMReport still used in Veeam 9? I'd like to know if it's still an active project.

Thanks
VMCE
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests