11 Replies Latest reply on May 26, 2005 10:23 AM by Michael Mraz

    NSH Script for Server Verification

      I heard that a script existed for automated server verification, similar to pressing the 'Verify Server' button (The one with the lightning flash) in RBAC Management, Server Properties.

       

      Does anybody know where I can find this?

        • 1. Re: NSH Script for Server Verification

          blcli Utility updateServersStatus

           

          Also, in the appserver / samples/blcli directory there is update-server-agent-status.nsh which is a complex wrapper for the blcli call.

          • 2. Re: NSH Script for Server Verification

            Hi Andrew,

             

            Thanks for that; I had seen that in the BLCLI help, but I don't suppose I read it properly! I probably saw AGENT_STATUS and skimmed the rest. D'Oh! slappage of forehead

            • 3. Re: NSH Script for Server Verification

              I've had issues with updating massive numbers of agents using that script. This takes a little longer but I have never had an issue with it. The "bl_servers.lst" file is the output of the 'blcli Server listAllServers' command.

               

              #!/usr/bin/perl -w

              use strict;

               

              my $server_list = "/opt/nsh/admin_scripts/lists/bl_servers.lst";

              my $logfile = "/opt/nsh/admin_scripts/logs/update_props.log";

              my $count = 0;

              my ($server, $return, $date);

               

              open SERVER_LIST, "&1`;

              if ( $return !~ /^void$/ ) {

              print "Failure!\n";

              } else {

              print "Successful!\n";

              }

              }

               

              close (SERVER_LIST);

              • 4. Re: NSH Script for Server Verification

                Attached is a modified update-server-agent-status script. It runs with sensibly with no options, has a -v verbose option and runs blcli for each server as Michael's perl script does.

                • 5. Re: NSH Script for Server Verification

                  i downloaded the new script and ran it but i am receiving "stuck thread" alerts when i run it with options.

                   

                  # ./update-server-agent-status.nsh -t 10 -o 60 -m all

                  Updating tosfosapp10

                  Error Updating Server: tosfosapp10

                  Error Code: 0 Output: Command execution failed. Stopping command because of stuck threads.

                  Updating prod-web5.scholastic.net

                  Error Updating Server: prod-web5.scholastic.net

                  Error Code: 0 Output: Command execution failed. Stopping command because of stuck threads.

                  Error Updating Server: qaaix12.scholastic.net

                  Error Code: 0 Output: Command execution failed. Stopping command because of stuck threads.

                  Updating qaaix14.scholastic.net

                   

                  I checked the server thread using blcli and none showed as being stuck.

                   

                   

                  when i run it without options, it says it is updating but when when check the CM server properties, it still shows as the old version:

                   

                  # ./update-server-agent-status.nsh

                  Updating tosfosapp10

                  Updating prod-web5

                  Updating qaaix12

                   

                  prod-web5 CM propeties BEFORE running script

                  AGENT_STATUS agent is alive Intrinsic (Read Only)

                  RSCD_VERSION 6.1.1.61 Intrinsic (Read Only)

                   

                  prod-web5 CM propeties AFTER running script

                  HOST prod-web5.scholastic.net Intrinsic (Read Only)

                  AGENT_STATUS agent is alive Intrinsic (Read Only)

                  RSCD_VERSION 6.1.1.61 Intrinsic (Read Only)

                   

                   

                  qaaix12 before running the script

                   

                  HOST qaaix12 Intrinsic (Read Only)

                  AGENT_STATUS agent is alive Intrinsic (Read Only)

                  RSCD_VERSION 5.2.0.1143 Intrinsic (Read Only)

                   

                  after running script:

                  HOST qaaix12 Intrinsic (Read Only)

                  AGENT_STATUS agent is alive Intrinsic (Read Only)

                  RSCD_VERSION 5.2.0.1143 Intrinsic (Read Only)

                   

                   

                  when i run an agent info against each server it shows to be on 6.2

                   

                   

                  # agentinfo prod-web5

                  prod-web5:

                  Agent Release : 6.2.0.77

                  Hostname : Prod-web5

                  Operating System: SunOS 5.8

                  User Permissions: 0/1 (root/other)

                  Security : Protocol=5, Encryption=TLS1

                  Host ID : 80D977FA

                   

                  1. of Processors : 1

                  License Status : Licensed for NSH/CM

                   

                  # agentinfo qaaix12

                  qaaix12:

                  Agent Release : 6.2.0.77

                  Hostname : qaaix12

                  Operating System: AIX 5.1

                  User Permissions: 0/0 (root/system)

                  Security : Protocol=5, Encryption=TLS1

                  Host ID : A156622

                   

                  1. of Processors : 2

                  License Status : Licensed for NSH/CM

                   

                  Any ideas on how to proceed?

                  • 6. Re: NSH Script for Server Verification

                    I'm seeing the same 'stuck thread' issue, as well. I was afraid it was just issues in our environment. Which version are you using? Which database? Are you experiencing any other database session concurrency issues?

                    • 7. Re: NSH Script for Server Verification

                      A couple of points:

                       

                      - The timeout (-o NNN) is in milliseconds, although it is not documented anywhere, so -o 60 is pretty short.

                       

                      - The new script posted does not update all values by default, you need to specify -u true to do that.

                      • 8. Re: NSH Script for Server Verification

                        i received the following reply from dan @ bladelogic and it worked successfully:

                         

                        1) The stuck thread issue you're seeing can be attributed to a very low timeout value passed to the scriopt. Please keep in mind that the '-o' switch value is in milliseconds, not in seconds. If you are seeking a 1 minute timeout, adjust your value to 60000.

                         

                        2) Running the script without any options sets the default value of the '-u' switch to false. This switch is used to determine if an update is actually performed in the appserver if the value returned differs from what the appserver already has. Run './update-server-agent-status.nsh -h' for more information and options on the script usage.

                         

                        3) Running an agentinfo against a server is a live query, whereas right clicking on a server in the CM and selecting properties often referrs to a memory cached value. This data is stored in several places, and depending on the function perfored to query the results, the returned value may differ.

                         

                        4) Based on what you submitted, we recommend you execute the script as follows:

                        './update-server-agent-status.nsh -t 20 -o 60000 -u true -m all'

                        • 9. Re: NSH Script for Server Verification

                          I've tried running this script against one server to familiarise myself with it, but I am getting the following error message:

                           

                          vmsun4% ./update-server-agent-status.nsh -t 20 -o 60000 -u true -m list vmdom9

                          ./update-server-agent-status.nsh:59: parse error near `in\^M'

                           

                          vmsun4% ./update-server-agent-status.nsh -t 20 -o 60000 -u true --method list vmdom9

                          ./update-server-agent-status.nsh:59: parse error near `in\^M'

                           

                          Any ideas what I am doing wrong here?

                          • 10. Re: NSH Script for Server Verification

                            It appears somewhere between the script being uploaded and you downloading it that the carriage returns were saved into the file. if you remove each '\' you find at the end of each line, the script should work.

                            • 11. Re: NSH Script for Server Verification

                              Also, if you're running it on a Unix box you can run 'dos2unix' on it to strip out the ^M characters.

                               

                              Or, using a perl one-liner (I don't "do" sed):

                               

                              perl -pi -e 's/^M//g'

                               

                              Make sure you insert an actual ctrl-M and not the string "^M". This is usually done by hitting ctrl-v then ctrl-M which escapes the character for you.

                               

                              -M