10 Replies Latest reply: Mar 22, 2012 11:58 PM by Santosh Pande RSS

    Looking for a way to script pproxcli commands on Windows.

    Garland Smith

      The pproxcli command located in pronto\PNS\bin directory provides a good way to check PatrolAgent

      connectivity and what's available.  However, it's tedious to enter the commands manually.  Since

      (presumably) pproxcli is reading from STDIN, it seems logical that one should be able to pipe commands

      from a file.  However, I haven't been able to get that to work.  Does anyone know how to get this to work?

       

      Thank you,

       

      Garlan dSmith

        • 1. Looking for a way to script pproxcli commands on Windows.
          Evan Wetstone

          Garland,

           

          I'm not sure about pproxcli but the pw command is basically a dos command file and there are issues with invoking dos shells from within another shell.  Try prefacing the pproxcli commands in your file with the "call" dos command.

           

          Regards,

           

          Evan

          • 2. Re: Looking for a way to script pproxcli commands on Windows.
            Garland Smith

            Hello Evan,

             

            pproxcli is an exe (pproxcli.exe).  When you run pproxcli, it runs and sits

            waiting for input

            from the command line.  You enter commands.   Essentially, it is a command line

            interpreter

            that takes action based on commands entered at the command line.

             

            E:\Program Files\ProactiveNet\pw\pproxy\PNS\bin>pproxcli

            /CORE/config/connect -host localhost -port 3182 -username admin -password admin

            /PATROL/query/getAgentDetails -agent ALL

            exit

             

            I want to pass in the commands that I would enter manually at the command line

            and have

            it execute these commands serially (as would be the case if I were typing them

            in at the

            command line).  I just can't figure out how to get these lines into pproxcli and

            have them

            executed serially:

             

            /CORE/config/connect -host localhost -port 3182 -username admin -password admin

            /PATROL/query/getAgentDetails -agent ALL

            exit

            If I can find a way to do this, it will be a powerful diagnostic/verification

            method.  Failing that,

            I have to type (or cut and paste) the commands serially, which slows things down

            substantially.

             

            Thank you,

             

            Garland Smith

            • 3. Re: Looking for a way to script pproxcli commands on Windows.
              Joseph Konieczka

              You should be able to use various scripting languages to do that. Are you running on a Windows system with perl installed or on a Unix platform? If you do a search for interactive control via Perl, you will find options about command redirection and piping control. Since it is not allowing piping from a file, using a handle might allow you to overcome that limitation. It would probably be the same kind of process you would go through with patrolcli which is also an interactive tool.

              • 4. Re: Looking for a way to script pproxcli commands on Windows.
                Hal DeVore

                And it goes without saying (doesn't it) that if you have the BPPM Server installed, you have Perl installed.  There is a copy of Perl in the BPPM installation tree.

                 

                --Hal

                • 5. Re: Looking for a way to script pproxcli commands on Windows.
                  Garland Smith

                  Thanks for your input.  I'm not sure how a scripting language would overcome the

                  obstacle of

                  getting the pproxcli to accept commands from STDIN.  I've included more

                  information below

                  showing results when entering the commands serially .vs. piping them in.

                   

                  Using pproxcli -debug produces the following:

                  When executing pproxcli and entering the following command, it works:

                  /CORE/config/connect -host localhost -port 3182 -username admin -password

                  .errs:

                  Thu Apr 07 12:56:51 2011: CLI mainloop entered....

                  Thu Apr 07 12:56:51 2011: Connecting host localhost port 3182 username admin

                  password 5CB994AF4BCC76FAB1DD66784B8A09F0

                  Thu Apr 07 12:56:51 2011: Failed to send the getMonitorInstanceDetails request

                  Thu Apr 07 12:56:51 2011: CLI _rip called

                   

                  Thank you,

                   

                  Garland Smith

                  • 6. Looking for a way to script pproxcli commands on Windows.
                    Joseph Konieczka

                    Essentially using a scripting language (or even using a separate KM) to simulate user interaction would allow you to accomplish what you need to do. When you do it interactively, you are passing in information from STDIN and then reading from STDOUT before sending the next command. By opening up a process channel (similar to the way the PATROL Agent can read from and write to process channels), you can simulate that level of interaction.

                     

                    Does that make more sense?

                    • 7. Re: Looking for a way to script pproxcli commands on Windows.
                      Garland Smith

                      Thanks for the clarification.  I've done things like this with Patrol using

                      popen().  I just need to dredge up the

                      methodology from the deep recesses of my vaccuous mind.

                       

                      Thank you,

                       

                      Garland Smith

                      • 8. Looking for a way to script pproxcli commands on Windows.
                        Jeffrey Hyson

                        See the following document ScriptPproxcli - Utility to Script PATROL Proxy CLI that provides a java command line application to do the job

                        • 9. Looking for a way to script pproxcli commands on Windows.
                          Santosh Pande

                          Hi,

                           

                          Aplokogies for stealing this thread.

                           

                          I tried to execute ScriptPproxcli but I am geting the following error

                           

                          E:\temp>"E:\BMC\BPPM_Agent_Proxy\Agent\JRE\bin\java" ScriptPproxcli -inputFile "E:\temp\input.txt"

                           

                          Error opening input file: E:\temp\input.txt

                          E:\temp\input.txt (The system cannot find the file specified)

                          java.io.FileNotFoundException: E:\temp\input.txt (The system cannot find the fil

                          e specified)

                                  at java.io.FileInputStream.open(Native Method)

                                  at java.io.FileInputStream.<init>(FileInputStream.java:106)

                                  at java.io.FileInputStream.<init>(FileInputStream.java:66)

                                  at java.io.FileReader.<init>(FileReader.java:41)

                                  at ScriptPproxcli.OpenFile(ScriptPproxcli.java:338)

                                  at ScriptPproxcli.ParseCommandLineArguments(ScriptPproxcli.java:229)

                                  at ScriptPproxcli.main(ScriptPproxcli.java:51)

                           

                          input.txt file exists in e:\temp but dtill getting this error, any help woul be appreciated

                           

                          Regards

                           

                          Santosh

                          • 10. Looking for a way to script pproxcli commands on Windows.
                            Santosh Pande

                            I sorted this, it was mistake with filename