1. Please help support our sponsors by considering their products and services.
    Our sponsors enable us to maintain high-speed Internet connection and fast webservers.
    They support this free information and knowledge exchange forum service at no cost to you.

    Please welcome our latest sponsor Tectrade . We can show our appreciation by learning more about Tectrade Solutions

Email reports

Discussion in 'TSM Reporting & Monitoring' started by TaSMania, Feb 1, 2018.

  1. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    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)?
     
  2.  
  3. marclant

    marclant ADSM.ORG Moderator

    Joined:
    Jun 16, 2006
    Messages:
    2,720
    Likes Received:
    377
    Occupation:
    Accelerated Value Specialist for Spectrum Protect
    Location:
    Canada
    You can use the Operations Center to email reports. However, it can only report using select commands, so you'd need: select * from nodes.

     
  4. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    great! my next thing was to setup a script to run that select so it will run once a month. OpCenter allows that schedule?
     
  5. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    Darn it, OC only have days and weeks option no monthy option.
     
  6. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    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.
     
  7. marclant

    marclant ADSM.ORG Moderator

    Joined:
    Jun 16, 2006
    Messages:
    2,720
    Likes Received:
    377
    Occupation:
    Accelerated Value Specialist for Spectrum Protect
    Location:
    Canada
    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.
     
  8. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    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?
     
  9. marclant

    marclant ADSM.ORG Moderator

    Joined:
    Jun 16, 2006
    Messages:
    2,720
    Likes Received:
    377
    Occupation:
    Accelerated Value Specialist for Spectrum Protect
    Location:
    Canada
  10. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    I was just looking up dsmc vs dsmadmc got it.
    Thank you.
     
  11. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    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?
     
  12. marclant

    marclant ADSM.ORG Moderator

    Joined:
    Jun 16, 2006
    Messages:
    2,720
    Likes Received:
    377
    Occupation:
    Accelerated Value Specialist for Spectrum Protect
    Location:
    Canada
    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"
     
  13. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    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.
     
  14. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    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)
     
  15. marclant

    marclant ADSM.ORG Moderator

    Joined:
    Jun 16, 2006
    Messages:
    2,720
    Likes Received:
    377
    Occupation:
    Accelerated Value Specialist for Spectrum Protect
    Location:
    Canada
    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).
     
  16. TaSMania

    TaSMania ADSM.ORG Member

    Joined:
    Nov 17, 2015
    Messages:
    75
    Likes Received:
    1
    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)
     

Share This Page