1 Reply Latest reply on Oct 8, 2008 12:05 PM by Bill Robinson

    Performance Commands newbie quickstart and associated issues.

      Greetings. I had some troubles getting my first NSH script utilizing Performance Commands to run. I had to pull a lot of information from several different sources to finally get this proof of concept script to run, so I thought I'd put it all down here for my fellow NSH neophytes to reference in the future.

       

      First, read up on Performance Commands in the BLCLI Help Documentation. This documentation can be found in Start -> All Programs -> BladeLogic -> BLCLI Help. Reference the section labeled "NSH Performance Commands" The "Command Reference" section will do a good job of priming you for your first run.

       

      However, I ran into a "gotchya" during this process. I set up my script as per the guidance I received from the Command Reference. (The script I'm refering to has been pasted in below this message.) From my numerous "echo" commands in my script, I could tell that the script has hanging after it made the "blcli_connect" call.

       

      Troubleshooting this issue down revealed the problem. The connection causes a new JVM to launch. This JVM has all of the connection details inside it that you've set up through instantiating your Performance Command environment. However, the "gotchya" is, you need to have some way to connect to the JVM in the first place. So, essentially what was happening is I did the "blcli_connect" command which stood up the new "Performance Command enabled" JVM, but when I went to go execute my first blcli_execute command against it, it was hanging on trying to figure out how to connect to the JVM in the first place.

       

      The answer to this problem can be found in the following forum thread.

       

      https://www.bladelogic.com/community/entry.jspa?entryID=82&categoryID=36

       

      The situation boils down to, you need to create a user_info.dat file to handle the connection to your Performance Command enabled JVM. I understand that setting up this user_info.dat file is a one time process and that there are security concerns that must be addressed when using this method of authentication. (If someone grabs that file from you, they can authenticate AS you.)

       

      Anyway, once I created that user_info.dat file, the script ran like a charm. I've tried to comment the script so as to be useful to someone looking at this issue for the first time. If anyone else out there could put more detailed information regarding what is actually happening with the user_info.dat file and why it is important to this process, I'm sure it would be greatly apprecaited.

       



      ################################################################################
      #
      # This script uses BLCLI Performance Commands.
      # It is necessary to use the Performance Commands if you
      # need to use "unreleased" commands, which this script does.
      #
      ################################################################################

      ################################################################################
      #
      # Before we can begin using Performance Commands in the BLCLI, we
      # need to establish a single sign-on authentication session.
      #
      ################################################################################

      # Create a service profile.
      blcred authprofile -add -profile mySP -host win1:9840 -type SRP
      echo "Just added the authprofile"

      # Populate the credentials cache.
      blcred cred -acquire -profile mySP -username "cmorris" -password "asdf"
      echo "Just passed username and password"

      # Specify BladeLogic Single Sign On authorization mechanism
      blcli_setoption authType BLSSO
      echo "Just set authType to BLSSO"

      # Set service profile name that we established earlier
      blcli_setoption serviceProfileName mySP
      echo "Just set serviceProfileName"

      # Define which role we intend to use.
      blcli_setoption roleName BLAdmins
      echo "Just set my role"

      #Finally, we can connect to the blcli
      blcli_connect
      echo "Boosh! Das kahnektshun!"

      ################################################################################
      #
      # Now that the trivial connection portion is out of the way, we can begin
      # with the real point behind this script.
      #
      ################################################################################

      SERVER_LIST=`blcli_execute Server listAllServers`
      echo "Just told it to grab a list of all servers"

      for SERVER in $SERVER_LIST

      do

      echo "Properties for server: $SERVER"
      # Sure, this dumps a ton of output to the screen, but it is an example of
      # running multiple executions under single sign-in proof of concept.
      blcli_execute Server printAllProperties $SERVER
      echo #drop a newline between entries for readability

      done

      ################################################################################
      #
      # Work complete, now let's close our connections and tidy up.
      #
      ################################################################################

      blcli_destroy
      echo "DESTROYED!!!"

       

        • 1. Re: Performance Commands newbie quickstart and associated issues.
          Bill Robinson

          The situation boils down to, you need to create a user_info.dat file to handle the connection to your Performance Command enabled JVM. I understand that setting up this user_info.dat file is a one time process and that there are security concerns that must be addressed when using this method of authentication. (If someone grabs that file from you, they can authenticate AS you.)

           

          This is only one way to establish your credentials - there are a number of other ways:

           

          1 - use the blcred command (which can read a user_info.dat) to establish credentials before you run your script.

           

          2 - if this script is run through the appserver as a NSHScriptJob you will have creds of the user/role you are logged into the GUI as (or the job is scheduled as)

           

           

          I'm a bit against using the user_info.dat file for a couple reasons:

          1 - as you say: (If someone grabs that file from you, they can authenticate AS you.)

           

          2 - people still set this file up under the 'bladmin' user's home directory (or Default User on windows) and this seems to override the creds coming though the appserver, which then breaks any nsh scripts running when you change BladeLogic user passwords which then ends up in alot of time troubleshooting.

           

          3 - the blcred provides a session-based authentication (er..kind of) that is not as persistent as the user_info.dat (back to #1)

           

           

          Also, if you use the user_info.dat, you don't need all of those _setoption statements...

           

          and... the examples in the doc i believe are for the blcli, not the performance commands, so doing the FOO=`blcli_execute ...` is bad but FOO=`blcli ...` is ok.