Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A way to append resources with nsradmin ?

Status
Not open for further replies.

denisfr

Technical User
Jul 11, 2005
217
FR
Hello,

I am trying to perform an operation which consists in updating all my clients to make them belonging to a specific group (in order to save CFI via a savegrp -O).

I've tried with nsradmin, but when I update the group attribute, it replaces all the old group attribute, so, if I have several groups for a client, I must extract the old groups names and report them to the update command.

Is there a way to 'append' a group name to an existing attribute with nsradmin without 'cheating' ?

Thanks in advance.

PS : I will also have to manage multiples instances of one client (i.e : the same client-id but different resource-id) because NW does not authorize me to have same savesets belonging to the same group on two instances of the same client.
 
If you are comfortable with adapting existing scripts, let me know and I'll paste a couple in here.

I have a pair of scripts that I use to add and delete groups from being serviced by pools from the command line. I suspect that with a couple of changes it could probably be adapted to what you want to do.

The short version is that it does editing of the "groups" attribute of an NSR pool object, and it sounds like you want to edit the "groups" attribute of a NSR client object.
 
No fear !
But only with shell or perl :)
 
Update" just means that you have tor rewrite the attribute/parameter value. To the best of my knowledge, there is no way to just append new data.
 
I just have to correct myself - in fact, there is an append command. in nsradmin, just use:

append parameter_name: new_value1; ..... last_value


 
Thanks a lot, I will try on Monday, at work...
 
No way with NSR733 on AIX 5.2...

nsradmin> append group:GRP-NETWORKER
unknown command: append

Is it a new feature coming with 7.4 ?


 
Just checked that and it seems that you are right - it is not there in 7.3.3. Just another "undocumented feature" that has been silently introduced.
 
I look at the manual on Powerlink, nor documented in 733 (I knew that), neither in 7.4 !
 
But at least in NW 7.4.1 ...

C:\nsr\bin>nsradmin
NetWorker administration program.
Use the "help" command for help.
nsradmin> help
Legal commands are:
bind [query]
create attrlist
delete [query]
edit [query]
help [command]
print [query] (set current query)
server [name]
show [attrlist]
types
update attrlist
append attrlist
quit
visual [query]
option

  • unset

    • . [query]
      ? [command]

      Where:
      query ::= attrlist
      attrlist ::= attribute [; attribute]*
      attribute ::= name [: [value [, value]* ]
      nsradmin>
 
ksh script 1 of 2 - this is a general script that I use as a foundation for other scripts. Output is not cleaned up, you will have to do that on your own.

Example usage:
nsrget "type: NSR client" "name"
This prints the name field of all objects of type "NSR client".

Code:
#!/bin/ksh

TFILE=/tmp/$$
rm ${TFILE} 2>/dev/null

ID="${1}"
FI="${2}"

echo ". ${1}" >> ${TFILE}
echo "show ${2}" >> ${TFILE}
echo "print" >> ${TFILE}
echo "quit" >> ${TFILE}

nsradmin -i ${TFILE} 2>/dev/null

rm ${TFILE} 2>/dev/null
 
ksh script 2 of 2 - this script is designed to change what groups are serviced by a given pool. You should find this very easy to adapt to editing what groups a client is a member of.

Usage:
Add a group to a pool's service list: chpool -a -g groupname -p poolname
Delete a group from a pool's service list: chpool -d -g groupname -p poolname
List a pool's served groups: chpool -l -p poolname

Code:
#!/bin/ksh

CMD="unset"
POOL="unset"
GROUP="unset"
SILENT="n"
TFILE=/tmp/$$.chpool
rm ${TFILE}* 2>/dev/null

function spew {
        if test "${SILENT}" == "n"
        then
                echo "${1}"
        fi
}

while test "${1}" != ""
do
        case "${1}" in
                "-l")
                        CMD="list"
                        ;;
                "-a")
                        CMD="add"
                        ;;
                "-d")
                        CMD="del"
                        ;;
                "-p")
                        POOL=${2}
                        shift
                        ;;
                "-g")
                        GROUP=${2}
                        shift
                        ;;
                "-sil")
                        SILENT="y"
                        ;;
                *)
                        spew "Illegal option ${1}"
                        ;;
        esac
        shift
done

SANE=1
case "${CMD}" in
        "unset")
                spew "Need a valid command: -l -a -d"
                SANE=0
                ;;
        "list")
                if test "${POOL}" == "unset"
                then
                        spew "Need a poolname: -p poolname"
                        SANE=0
                fi
                ;;
        "add"|"del")
                if test "${POOL}" == "unset"
                then
                        spew "Need a poolname: -p poolname"
                        SANE=0
                fi
                if test "${GROUP}" == "unset"
                then
                        spew "Need a groupname: -g groupname"
                        SANE=0
                fi
                ;;
        *)
                spew "You have somehow set an illegal command value."
                SANE=0
                ;;
esac

if test ${SANE} -eq 0
then
        spew "Failed a sanity check."
        exit
fi

case "${CMD}" in
        "list")
                nsrget "type: NSR pool; name: ${POOL}" "groups" | tail +2 | sed s/"groups:"/""/g | tr -d ",;" | awk -F" " '{print $1 "\n" $2}' | sort | grep -v "^$"
                ;;

        "add")
                OLDSIL="${SILENT}"
                SILENT="n"
                GROUPLIST=`(${0} -sil -l -p ${POOL}; echo "${GROUP}") | sort -u | xargs echo | tr " " ","`
                echo ". type: NSR pool; name: ${POOL}" >> ${TFILE}
                echo "update groups: ${GROUPLIST}" >> ${TFILE}
                echo "quit" >> ${TFILE}
                nsradmin -i ${TFILE} >/dev/null 2>&1
                #${0} -sil -l -p ${POOL}
                SILENT="${OLDSIL}"
                ;;
                

        "del")
                OLDSIL="${SILENT}"
                SILENT="n"
                GROUPLIST=`${0} -sil -l -p ${POOL} | grep -v "${GROUP}"  | sort | xargs echo | tr " " ","`
                echo ". type: NSR pool; name: ${POOL}" >> ${TFILE}
                echo "update groups: ${GROUPLIST}" >> ${TFILE}
                echo "quit" >> ${TFILE}
                nsradmin -i ${TFILE} >/dev/null 2>&1
                #${0} -sil -l -p ${POOL}
                SILENT="${OLDSIL}"
                ;;
        
        *)
                spew "Command ${CMD} unimplemented."
                ;;
esac

 
I need migrate the NetWorker Server from NT Domain to AD Domain.

Is the same server. same OS installation and same hostname. This only difference is the domain!
To Networker it is transparent? It has some cares to have, for example, with licensing?

Thanks in advance for your help.
 
Start a new message, please.

Your one if off-topic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top