3 Replies Latest reply on Jan 20, 2012 8:07 AM by Bill Robinson

    Need to get server name for an Type 1 nsh job

      I need to run the following script to collect a few server object properties on a regular basis for several thousand servers during a very limited maintenance window. Although the script does not change anything, it still must be completed within that maintenance window. Because of the limited maintenance window, I do not want to run the script as a Type 2 script.


      DATE=`date +%m%d%y`


      # SERVERNAME=`hostname`


      BLCLICMD=(Server getServerName)
      SERVERNAME=`blcli_execute "${BLCLICMD[@]}"`


      BLCLICMD=(Server printPropertyValue "${SERVERNAME}" "LM_ENVIRONMENT")
      SERVPROP1=`blcli_execute "${BLCLICMD[@]}"`


      BLCLICMD=(Server printPropertyValue "${SERVERNAME}" "LM_MARKET")
      SERVPROP2=`blcli_execute "${BLCLICMD[@]}"`


      BLCLICMD=(Server printPropertyValue "${SERVERNAME}" "OS")
      OS=`blcli_execute "${BLCLICMD[@]}"`


      BLCLICMD=(Server printPropertyValue "${SERVERNAME}" "OS_RELEASE")
      OSRELEASE=`blcli_execute "${BLCLICMD[@]}"`


      # redirect output to the central server
      echo ${SERVERNAME},"Server",${SERVPROP1},${SERVPROP2},${OS},${OSRELEASE} > //LogServer/fileshare/Audit-${SERVERNAME}-${DATE}.txt


      The problem is that the name for many of the servers is an FQDN. The script works using hostname when the server name is the short name (i.e. see the commented out line SERVERNAME=`hostname') but when does not. I need a way to capture the server name in BladeLogic so I can query the server for the properties in my report.


      I thought the Server getServerName blcli command would give me the server name like I need it but it does not. Any suggestions?


      Thanks in advance.