Email reports

TaSMania

ADSM.ORG Member
Joined
Nov 17, 2015
Messages
126
Reaction score
1
Points
0
Other than output queries to paths or directory. How would I make send to email?

Query Node * F=D > email
or any select statement.
is this capable via TSM> or something outside of TSM(SP)?
 
You can use the Operations Center to email reports. However, it can only report using select commands, so you'd need: select * from nodes.

 
great! my next thing was to setup a script to run that select so it will run once a month. OpCenter allows that schedule?
 
Darn it, OC only have days and weeks option no monthy option.
 
I want to turn my manual labor into automation.
What I've been doing is run sql statement and open it in excel with delimited.
I could create a script that run the command but not sure how to have .csv attached to email for reports to team or company.
 
So, you are trying to do two things really.
1 - create a .CSV, which is easy to do with dsmadmc, I think you already know how to do that
2 - send that CSV by email

The latter can't be done with Spectrum Protect. But there are command line utilities for most platforms to email files. So you would need one of those utilities, and create a script that you run from the OS that does 1 and 2.
 
I'm going to take one step at a time. I've read there's blat file. I think most people use pearl .pl

so I started with .bat file
cd "c:\program files\tivoli\tsm\baclient"

dsmc * this works

dsmc query node * f=d > /temp/test.txt * this doesn't work

dsmc -query node * f=d > /temp/test.txt * this doesn't work

dsmc
query node * f=d > /temp/test.txt * this doesn't work


What am I missing?
will the above work if it's .pl?
 
I was just looking up dsmc vs dsmadmc got it.
Thank you.
 
ok.
mytest.bat
dsmadmc -id=me -password=me -outfile=c:\temp\test.txt query node * .......... <-- it works
dsmadmc -id=me -password=me -outfile=c:\temp\test.txt select..statement..command.......... <--it failed
dsmadmc -id=me -password=me select..statement..command > \temp\test.txt .......... <--it failed

manual
tsm: isp01> -outfile=c:\temp\test.txt select..statement..command......... <--it failed
tsm: isp01> select..statement..command > \temp\test.txt ......... <--it works


would it matter if it's in mytest.bat vs mytest.sh or mytest.pl?
 
I find it works better to put commands and selects in quotes.
dsmadmc -id=me -pa=password -outfile=x:\out.txt "select * from table"
dsmadmc -id=me -pa=password "select * from table" > x:\out.txt
dsmadmc -id=me -pa=password -comma -outfile=x:\out.csv "select * from table"
 
cool that works! I think you had helped me before with using the * but I keep forgetting.
Now is emailing the out.txt file.
to be continue....
Have a good weekend guys.
 
So I did this to send and it worked with powershell.
Now I have to find a way to combine all 3 into 1.
1. .bat to query data
2. .ps1 to send data
3. Start services for both above to run daily



$fromaddress="[email protected]"
$toaddress="[email protected]"
$Subject="testing Files"
$body="Just testing my coding outside of .pl"
$attachment="C:\Temp\TEST.csv"
$smtpserver="mail.google.com"
####################################
$message=new-objectSystem.Net.Mail.MailMessage
$message.From =$fromaddress
$message.To.Add($toaddress)
$message.Subject =$Subject
$attach=new-objectNet.Mail.Attachment($attachment)
$message.Attachments.Add($attach)
$message.body =$body
$smtp=new-objectNet.Mail.SmtpClient($smtpserver)
$smtp.Send($message)
 
You could use the TSM Client Scheduler and with a client schedule that has action=command object=(script name).

Alternatively, you could use the AT scheduler in Windows (command) or Task Scheduler (GUI).
 
Thanks for your help. I got it working.

I added my dsmadmc with .\ in the front and select statement " " above the powershell code below. All I had to do was add task scheduler to trigger it. Only thing i'm worry about is when I execute the ps1 manually it ran real quick. It is still running in my task scheduler... hmmm

cd "c:\program files\Tivoli\tsm\baclient"
.\dsmadmc -id=admin -pa=admin -outfile=c:\temp\test.csv "select ...."

####################################
$fromaddress="[email protected]"
$toaddress="
[email protected]"
$Subject="testing Files"
$body="Just testing my coding outside of .pl"
$attachment="C:\Temp\TEST.csv"
$smtpserver="mail.google.com"

####################################
$message=new-objectSystem.Net.Mail.MailMessage
$message.From =$fromaddress
$message.To.Add($toaddress)
$message.Subject =$Subject
$attach=new-objectNet.Mail.Attachment($attachment)
$message.Attachments.Add($attach)
$message.body =$body
$smtp=new-objectNet.Mail.SmtpClient($smtpserver)
$smtp.Send($message)
 
Back
Top