Harvest

  • 1.  E03020134: tcgetattr: Invalid argument

    Posted Jul 05, 2016 03:49 PM

    Hi Guys!

     

    Small help required here please, I'm doing automation with UDP but when I'm doing ssh some times instead the output I got

    I00020133: Pseudo-terminal will not be allocated because stdin is not a terminal, so to avoid this I force the terminal by add into the ssh comant multiple -t as result I got the error "E03020134: tcgetattr: Invalid argument."

    Example of this:

    ssh -q -tt ${PRODID}@${JSERVER} "

    ssh -q -tt ${PRODID}@${MyServer} 2>/dev/null << EOF

    sudo -u someuser /opt/someuser/someplace/instance_name/bin/tcruntime-ctl.sh start

    exit

    EOF    2>&1"

     

    Whit single -t or none I got "I00020133: Pseudo-terminal will not be allocated because stdin is not a terminal"

    With multple -tt or -ttt i got "E03020134: tcgetattr: Invalid argument."

     

    But if I run directly from terminal the script is able to pullback all output, this only happen when calling since harvest GUI

     

    Regards and thanks.



  • 2.  Re: E03020134: tcgetattr: Invalid argument

    Broadcom Employee
    Posted Jul 06, 2016 10:43 AM

    Is this UDP configured to be "client-side" (to be run on the Windows computer where Workbench is running) or "server-side" (to be run on the broker machine)? If it's a "client-side" UDP, have you tested on a Windows computer where Workbench is running?  If it's "server-side", what operating system is your broker machine? UDPTypeOptions.jpg

    You might consider executing your commands on the remote computer using "hexecp" instead of the secure shell.  This would require to set up a SCM Agent on the remote computer, but might be a little more reliable.

     

    Let me know if this helps.



  • 3.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 06, 2016 12:31 PM

    Thanks Melinda,

     

    I'm using UDP configured as Server Side, and the operating system where is Linux version 2.6.18-409.el5 (mockbuild@x86-031.build.eng.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-55))

     

    Regards



  • 4.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 06, 2016 03:03 PM

    Hi Carlos,

    What function is the tcgetattr.  Also I'm a little confused by the ssh -tt option.  It does not look like that is a valid option for ssh.



  • 5.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 11, 2016 09:18 AM

    tcgetattr it's what harvest error message when you try to capture soem result from ssh session, the multiple use of -t it's documented on ssh you can use -t -t ot -ttt it is to "FORCE" the terminal emulation.



  • 6.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 07, 2016 04:39 PM

    Hi Carlos,

     

    The ssh command is being run by one of the hserver daemon processes, hence it has no terminal associated with it.  This is not normally a problem.  What command are you running?  And does it really need a terminal?  It might if it uses Curses or similar and moves the cursor around the screen rather than producing lines of output.

     

    The ssh documentation does imply that specifying multiple -t (i.e. -t -t) switches should force a tty to be allocated, but this is not something I have ever had cause to try.

     

    Are you sending input on stdin (the input text box on the UDP)?  If not, then you may be better to specify -n to close stdin.  This can also help prevent processes hanging whilst waiting for stdin to close.

     

    Best regards,

     

         R.



  • 7.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 11, 2016 09:26 AM

    Hi Bob,

     

    Do you know if there is a way to configure hserver daemon processes in order force terminal emulation?

    In my posted code I actually force the terminal emulation by using -tt also I'm trying to grab stdin and stderr going back to UDP, by using 2>&1. If I run manually the script in a terminal works perfectly, but when is called by harvest I'm getting that kind of errors back by the hserver daemon processes. the command that basically I want run it's a tomcat start instance.

     

    Regards

    Carlos



  • 8.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 11, 2016 09:39 AM

    Hi again Carlos,

     

    Harvest won't have any way of emulating a terminal, but I don't think you really need one, as Tomcat scripts should not need either stdin or a terminal, so I would try running the command with -n in place of the -t switches.  The only odd thing that might stop the output being printed correctly is that some of these scripts use "su" in them, so that they run as the tomcat user, which often has no login capability.  "su" sometimes messes up the streams - I had this with an init.d script on my NAS.

     

    Harvest captures both stdout (1) and stderr (2) and reports them back to the user with stderr highlighted in red.  The only occasional problem with this is that the streams are handled independently and the ordering of the messages may appear wrongly.  2>&1 will redirect all output to stdout.

     

    I take it you can run the command you want from a shell on the Harvest server, running it as the "harvest" user?  If you can, then try running it using nohup to disconnect the terminal and see if that recreates the problem?

     

    Best regards,

     

         R.



  • 9.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 20, 2016 09:51 AM

    Hi Bob,

     

    Sorry for long delay, I was trying this work out, I tried given option, but didn't work, ssh -n send all to backgroung but I need use "sudo" to perform such tasks so if I remove -tt I still getting message "you must have a tty to run sudo".

     

    Thanks for your time.



  • 10.  Re: E03020134: tcgetattr: Invalid argument

    Posted Jul 21, 2016 08:55 AM

    Hi Carlos,

     

    If you are able to modify /etc/sudoers, then you may be able to use the advice given in this post: linux - Why do I need a tty to run sudo if I can sudo without a password? - Unix & Linux Stack Exchange

     

    Best regards,

     

          R.