Use the following example as a starting point when developing your own script.
This example assumes that the file sp-ips.txt contains a newline delimited list of Service Processor IP addresses. For example:
10.10.30.15
10.10.30.16
10.10.30.17
10.10.30.18
The following script copies the SNMP trap destination list from the source Service Processor, 10.10.30.5, to the Service Processors listed in the file sp-ips.txt.
#!/bin/sh
source=10.10.30.5
snmp_destinations=`ssh $source sp get snmp-destinations`cat sp-ips.txt | while read ip; do
# Delete this SP's current SNMP destination set
for snmp_trap_dest in $(ssh $ip sp get snmp-destinations); do
ssh $ip sp delete snmp-destination $snmp_trap_dest
done# Now add the trap destinations from the source SP
for snmp_trap_dest in $snmp_destinations; do
ssh $ip sp add snmp-destination $snmp_trap_dest
done
done