• Please help support our sponsors by considering their products and services.
    Our sponsors enable us to serve you with this high-speed Internet connection and fast webservers you are currently using at ADSM.ORG.
    They support this free flow of information and knowledge exchange service at no cost to you.

    Please welcome our latest sponsor Tectrade . We can show our appreciation by learning more about Tectrade Solutions
  • Community Tip: Please Give Thanks to Those Sharing Their Knowledge.

    If you receive helpful answer on this forum, please show thanks to the poster by clicking "LIKE" link for the answer that you found helpful.

  • Community Tip: Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING)

    Click the link above to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This notice will disappear after you have made at least 3 posts.

Email reports

TaSMania

ADSM.ORG Member
#1
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)?
 

marclant

ADSM.ORG Moderator
#2
You can use the Operations Center to email reports. However, it can only report using select commands, so you'd need: select * from nodes.

 

TaSMania

ADSM.ORG Member
#5
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.
 

marclant

ADSM.ORG Moderator
#6
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.
 

TaSMania

ADSM.ORG Member
#7
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?
 

TaSMania

ADSM.ORG Member
#10
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?
 

marclant

ADSM.ORG Moderator
#11
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"
 

TaSMania

ADSM.ORG Member
#12
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.
 

TaSMania

ADSM.ORG Member
#13
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)
 

marclant

ADSM.ORG Moderator
#14
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).
 

TaSMania

ADSM.ORG Member
#15
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)
 

Advertise at ADSM.ORG

If you are reading this, so are your potential customer. Advertise at ADSM.ORG right now.

UpCloud high performance VPS at $5/month

Get started with $25 in credits on Cloud Servers. You must use link below to receive the credit. Use the promo to get upto 5 month of FREE Linux VPS.

The Spectrum Protect TLA (Three-Letter Acronym): ISP or something else?

  • Every product needs a TLA, Let's call it ISP (IBM Spectrum Protect).

    Votes: 9 22.0%
  • Keep using TSM for Spectrum Protect.

    Votes: 20 48.8%
  • Let's be formal and just say Spectrum Protect

    Votes: 8 19.5%
  • Other (please comement)

    Votes: 4 9.8%

Forum statistics

Threads
31,025
Messages
132,107
Members
21,267
Latest member
andyh2468
Top