ahmetkececiler
2 Bronze

A different way to create and email avamar reports.

A different way  to create and email avamar reports.

Hello All,

Reporting in avamar always in my nightmares. I usually use avamar cli mccli and some other tools on avamar. But an automated emaling always has been problem for me . Today i tried somtehing else and wolla it worked perfectly .Now i want to share this with you.

First we need some tools for this . I belive that almost all of us familiar with them.

Here we go ,

  1. Windows Server ( I did this in my customer env. And they mostly have windows. I used win 2008 server)
  2. We need winscp ( If you are not already  have)
  3. Winrar (again if you are not already have)

First i connect avamar with winscp. Then ,

I save the session information ,1.png

Warning : This action may have security issues. So do it with your own risk.

After that i create some scripts . I will try to explain them below. Basically i create 3 windows batch you can merge them or split whatever you want.

  1. My first script is created with winscp commands,

In first line i am changing folder to be able to run winscp commands,

cd "c:\Program Files (x86)\WinSCP"

winscp /console /command "open avamar" "call /usr/local/avamar/bin/./replcnt.sh > /home/Reports/replication_log.txt"

In above line winscp conencts the avamar with saved user name and password. After connected it runs “call”command and the replication report script.

winscp /console /command "open avamar" "call capacity.sh > /home/Reports/capacity_log.txt" "exit"

I added the the what ever i need.

winscp /console /command "open avamar" "call status.dpn > /home/Reports/status_dpn.txt" "exit"

winscp /console /command "open avamar" "call dpnctl status > /home/Reports/dpnctl_status.txt" "exit"

winscp /console /command "open avamar" "cd /home/Reports" "get *.txt E:\Reports\ " "exit"

and the last line is connecting avamar and goes to my report folder and copying all txt files to my windows server.

And here is the output files

2.png

3.png

Ok good now we have our reports on our windows server what is next ?

I need to keep them with date format so here is second batch . It renames our files with date format.

set HR=%time:~0,2%

    set HR=%Hr: =0%

    set HR=%HR: =%

    rename e:\Reports\capacity_log.txt capacity_log_results_%date:~10,4%-%date:~4,2%-%date:~7,2%_%HR%%time:~3,2%.txt

rename e:\Reports\dpnctl_status.txt dpnctl_results_%date:~10,4%-%date:~4,2%-%date:~7,2%_%HR%%time:~3,2%.txt

    rename e:\Reports\status_dpn.txt status_results_%date:~10,4%-%date:~4,2%-%date:~7,2%_%HR%%time:~3,2%.txt

    rename e:\Reports\replication_log.txt replication_log_results_%date:~10,4%-%date:~4,2%-%date:~7,2%_%HR%%time:~3,2%.txt

And here is the output.

4.png

Now we have reports that renamed with dates.

And this time i need to zipped these files. This time i use winrar. This is the third batch file.

First i set home env. For winrar then change the directory to my reports directory

set path="C:\Program Files\WinRAR\";%path%

cd e:\Reports

rar a -r e:\Reports\reports.rar E:\reports\*.txt e:\Reports\Reports.rar

5.png

Its all done . Now we just need to schedule these batch files with windows task scheduler.

6.png

And email them again with task scheduler.

7.png

And it works .

8.png

I hope it is usefull for everybody who uses Avamar. Have nice works.

Ahmet Keçeciler