The script below can be used to show CDP information on Absolute Manage for Mac OS X clients. To make the script working, it’s necessary first to compile the cdpr tool. This step is documented in another post on this blog. You can simply add this script to a new Custom Information Field in Absolute Manage and assign to all computers.
Two variables are editable :
– The path to the cdpr binary (CDPR_PATH)
– The timeout (CDPR_TIMEOUT)
#!/bin/bash #adminsys.ch - FTBZ - 31.08.2012 #VARIABLES CDPR_PATH="/usr/local/bin/cdpr" CDPR_TIMEOUT="90" #CHECK IF CDPR WAS INSTALLED if [ ! -f $CDPR_PATH ];then echo "cdpr seems not installed on this computer." exit fi #GET ETHERNET NETWORK INTERFACES INTERFACES=`networksetup -listnetworkserviceorder | awk '/Ethernet/{getline; print $(NF)}' | sed "s/.$//"` #SHOW THE CDPR INFORMATION for INTERFACE in $INTERFACES; do $CDPR_PATH -t $CDPR_TIMEOUT -d $INTERFACE | awk '/Device ID|Port ID/{getline; print $(NF)}' done exit
This script was tested only with Mac OS X 10.7 and OS X 10.8.