Tille's SiteUsing the command-line smcregister command, the task of adding other machines to the management console needn't be an endless click-and-point job.
Here's a possible sollution:
#!/bin/bash
# Make a list of hosts to add, for instance from the /etc/hosts file.
# Alternatively you can contact other name services, such as LDAP or DNS.
LIST=`cat /etc/hosts | grep ws- | awk '{ print $2}'`
# | grep ws is because our hostnames happen to start with "ws"
# Alternatively, use cut instead of awk:
# If your hosts are e.g. in the 10.20.30 network:
# grep 10.20.30 /etc/hosts | cut -f 1
# The LIST can also be redirected to a file for future reference:
# LIST=/var/tmp/hostlist
# cat /etc/hosts | grep ws- | awk '{ print $2}' > $LIST
# Use "cat $LIST" and "for i in `cat $LIST`" if you want to use a file
# instead of a variable.
# Make backup copies of config files:
cp /var/sadm/smc/toolboxes/smc/smc.tbx /var/sadm/smc/toolboxes/smc/smc.tbx.bak
cp /var/sadm/smc/toolboxes/this_computer/this_computer.tbx \
/var/sadm/smc/toolboxes/this_computer/this_computer.tbx.bak
# Give the user a chance to break out before we really start changing config
# files:
echo "Hosts that will be added:"
echo "$LIST"
echo "Do you wish to contine? ([yes]/no)"; read ANSWER
if [ $ANSWER = "no" ]; then
echo "OK, quitting now."
exit 5
else
for i in $LIST; do
/usr/sadm/bin/smcregister toolbox add -f tbxURL \
http://$i:898/toolboxes/this_computer.tbx \
-B /var/sadm/smc/toolboxes/smc/smc.tbx
echo "$i added to the console."
done
fi
After that, you can start adding particular toolboxes for each host. The name of the toolbox can be found in SMC by clicking on the toolbox. Or you can try to analyze the cryptic definitions in the /var/sadm/smc/toolboxes/this_computer/this_computer.tbx file. Here is an overview:
The following example adds the log viewer functionality to each registered host:
for i in $LIST; do /usr/sadm/bin/smcregister toolbox add -f tool \ com.sun.admin.logviewer.client.VLogViewer -H "$i":898 done
SMC makes use of Web-Based Enterprise Management, which was developed by the Distributed Management Task Force. WBEM is based on the Common Information Model (CIM), providing a method to describe systems, applications, networks and devices. The data are represented in XML. Read more about WBEM Service development here at SourceForge or try apropos wbem on your system.
Remember that the WBEM service should be running on the hosts for this to work. The service is started using the wbem.init script from /etc/init.d.
| Home |