1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link 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 message will disappear after you have made at least 12 posts. Thank you for your cooperation.

script for adding a new node

Discussion in 'Scripting' started by tsmuser10, Sep 26, 2012.

  1. tsmuser10

    tsmuser10 New Member

    Joined:
    Oct 11, 2004
    Messages:
    201
    Likes Received:
    0
    First of all not much of scripter......but I'm looking for a script or tips on creating a script for others to use to add a node. Would like it to maybe prompt for domain name/password. Again just looking for pointers

    THX
     
  2.  
  3. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,112
    Likes Received:
    272
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    Something like this for DOS:

    @echo off

    set /P node=Enter node name to register:
    set /P pass=Enter password to set for node:
    set /P domain=Enter Domain to register node:

    dsmadmc /id=admin /pa=password "register node %node% %pass% do=%domain% passexp=0 maxnummp=4"
     
    Last edited: Sep 26, 2012
  4. tomk

    tomk New Member

    Joined:
    Jul 5, 2011
    Messages:
    2
    Likes Received:
    0
    Occupation:
    Storage/Backup Adminsitrator
    Location:
    Vienna
    i've created such script for every domain

    reg node $1 PASSWORD do=DOMAIN passexp=0 maxnummp=4
    def assoc DOMAIN $2 $1

    the run the script `run r_node NODENAME SCHEDULER_NAME`
     
  5. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    I am new to scripting and automation in TSM, i am looking to automate the TSM decommission process so that it should prompt for node name to decommission and prompt to update the contact information.. any help is appreciated...
    thanks in advance...
     
  6. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,112
    Likes Received:
    272
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    Unix or DOS?

    When you say 'decommission', do you delete the node and its backup? If you do this, why update the contact information?

    The simplicity or complexity of the script depends on your answer to the questions above.
     
  7. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    I am decommissioning the node which are registered in TSM and I am doing it from TSM end.. we maintain 90 days of client data after final backup of the server which is going to decommission.. we are updating the contact information with the incident/Ticket details so that we come to know who requested us to decommission the client..

    Thank you...
     
  8. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,112
    Likes Received:
    272
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    You haven't mention if you want this to run on DOS or UNIX.

    Reason: the script would most likely be ran outside of TSM

    If you are just decommissioning a few nodes, why don't you just do this manually.
     
  9. blew

    blew New Member

    Joined:
    Jul 27, 2009
    Messages:
    11
    Likes Received:
    2
    Occupation:
    System Engineer - Backup system administrator
    Location:
    Rome
  10. reesema

    reesema New Member

    Joined:
    Jan 5, 2006
    Messages:
    44
    Likes Received:
    3
    We use a TSM script to decommission nodes to make sure the contact field is in a standard format. We then run another script on a regular basis to determine when the decommissioned nodes can be deleted. Here's our decommission script:

    Code:
    /* Parameters:                                 */
    /*   $1 = Node to be deactivated               */
    /*   $2 = Date node is to be deleted in the    */
    /*        format MM/DD/YYYY                    */
    update node $1 contact="[DELETE NODE ON $2]"
    lock node $1
    
     
  11. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    We are using TSM 6.3 on Linux machine, below i what i am looking for... we are looking to run this script as TSM script..

    Commands to run..
    Rename node "node_name" [it should prompt for the node name] "node_name_keep90" [same node_name should be entered with _keep90] contact=" " [prompt for the information]

    Thank you all for the response..

    Awaiting for the reply.
     
  12. Rigido

    Rigido New Member

    Joined:
    Apr 21, 2006
    Messages:
    67
    Likes Received:
    1
    Occupation:
    AIX, TSM and Storage specialist
    Location:
    Rome, Italy
    Don't think TSM scripts can prompt for anything, you must use "external" scripting (batch on Windows, shell on Linux).
     
  13. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    Hello Rigido,

    could you please help me in building the external scripting as I am new to scripting..
     
  14. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,112
    Likes Received:
    272
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    #!/bin/ksh

    ## Environmental variables ##

    ID=admin_id
    PA=admin_password

    COMD="dsmadmc -id=$ID -pa=$PA -noc -dataonly=yes -display=table -tab"

    ## Main

    echo -e "Enter node name to rename: \c"
    read NODE
    echo " "
    echo -e " The name of the node entered is "`echo $NODE|awk '{print toupper($0)}'`""
    echo " "
    echo "$NODE will now be renamed to $NODE"_keep90""
    echo " "
    $COMD "rename node $NODE $NODE"_keep90""
    echo " "
    echo -e "Enter the contact information: \c"
    read CONT
    $COMD update node $NODE"_keep90" contact="`echo ${CONT}`"

    This should change the name.

    Caveat:

    1. The contact info should be enclosed in quotes like: "This node is to be kept for 90 days"
    2. The schedule is still active even if the node has been renamed. To eliminate backup reports from this node, add lines to the script to delete schedule association
    3. Run this from within the TSM server using the instance owner account (with access to dsmadmc) or root
     
    Last edited: Jan 30, 2015
  15. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    thank you moon buddy... will let you know the result..
     
  16. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    Hello Moon buddy,

    It worked thank you very much, as suggested I will make some adjustments to remove the nodes from the schedule before renaming.
     
  17. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,112
    Likes Received:
    272
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    Here is the script which also deletes the schedule:

    #!/bin/ksh

    ## Environmental variables ##

    ID=admin_id
    PA=admin_password

    COMD="dsmadmc -id=$ID -pa=$PA -noc -dataonly=yes -display=table -tab"

    ## Main

    echo -e "Enter node name to rename: \c"
    read NODE
    echo " "
    echo -e "The name of the node entered is "`echo $NODE|awk '{print toupper($0)}'`""
    echo " "
    echo "A search for the schedule will now take place, and the schedule will be deleted"
    $COMD "select schedule_name from associations where node_name='`echo $NODE|awk '{print toupper($0)}'`'" > SCHED
    $COMD "select domain_name from associations where node_name='`echo $NODE|awk '{print toupper($0)}'`'" > DOM
    echo "The schedule for "`echo $NODE|awk '{print toupper($0)}'`" is "`cat SCHED`" on domain "`cat DOM`""
    echo "Deleting the schedule"
    echo " "
    $COMD "delete association `cat DOM` `cat SCHED` `echo $NODE`"
    echo " "
    echo "$NODE will now be renamed to $NODE"_keep90""
    echo " "
    $COMD "rename node $NODE $NODE"_keep90""
    echo " "
    echo -e "Enter the contact information: \c"
    read CONT
    $COMD "update node $NODE"_keep90" contact="`echo ${CONT}`""
    exit 0
     
  18. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    hello moon buddy thank you...
     
  19. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    22
    Likes Received:
    0
    I am trying to write a script to check the disk pool status and start the migration if it is above threshold.... I am not sure how to open a new thread... can you please check the below script and let me know if it works fine..

    I am getting the error at below line.. count.rn file in not updating..
    grep $i.rn >> count.rn
    VAL=`cat count.rn`
    if [ $VAL -lt 60 ]


    Script

    _dat=`date +"%Y-%m-%d %HH:%MM"`
    _sub=`printf "%s" "Disk Pool Utilisation @ $_dat "`
    echo "Team," > mail.rn
    echo "Please migrate the data " >> mail.rn
    echo " ===================================== " >> mail.rn
    for i in `cat /home/xtkumar/tsmserver.txt`
    do
    _i=`dsmadmc -se=$i -id=user -pa=paswd -dataonly=yes "SELECT STGPOOL_NAME, pct_utilized FROM stgpools WHERE stgpool_name like '%LD%'"`
    echo $_i > $i.rn
    grep $i.rn >> count.rn
    VAL=`cat count.rn`
    if [ $VAL -lt 60 ]
    then
    echo "diskpools are within threshold" >> mail.rn
    else
    echo "Need to migrate the data"
    _n=`dsmadmc -se=$i -id=user -pa=paswd -dataonly=yes -display=table -tab "migrate stgpool $1 lo=0"`
    else
    grep -q ANR4922E "$i.rn";
    then
    echo " Migration is in progress please monitor "
    done
     

Share This Page