1

Topic: Telnet into Nion with AMX

I'm trying to telnet into a Nion from AMX to perform an unattended reboot if it goes into fault, but having no luck.  Seems like it would be more graceful than resetting the power.  AMX diagnostics tells me the port(23) is open, but the Nion does not respond to the "root" or "reboot" command like a DOS telnet session does.  Attached is a piece of AMX code I used for testing.  Anyone have any ideas on what I might be doing wrong?

AMX Code

DEFINE_DEVICE

dvNION1_TN_PORT = 0:4:0
dvTP = 10001:1:0   

DEFINE_VARIABLE

VOLATILE CHAR cNION1IP[15] = '10.42.51.39'  //IP ADDRESSES OF NION
LONG TELNET_PORT    =    23

DEFINE_EVENT

BUTTON_EVENT[dvTP,1]
{
   Push:
   {
      IP_CLIENT_OPEN(dvNION1_TN_PORT.Port, cNION1IP, TELNET_PORT ,1)
    }
}

BUTTON_EVENT[dvTP,2]
{
    Push:
    {
        SEND_STRING dvNION1_TN_PORT,"'root',$0D,$0A"
    }
}

BUTTON_EVENT[dvTP,3]
{
    Push:
    {
        SEND_STRING dvNION1_TN_PORT,"'reboot',$0D,$0A"
    }
}

DATA_EVENT[dvNION1_TN_PORT]
{
    STRING:
    {
        SEND_STRING 0, "'NION1: ',DATA.TEXT"
    }
    ONERROR:
    {
     Send_String 0, "'NION1 TN PORT ERROR IS ', ITOA(DATA.NUMBER)"  //Send the error number to Diagnostics
     Switch (DATA.NUMBER)//Send error message to diagnostics
     {
        CASE 2:    Send_String 0,'Onerror 2: General failure (out of memory)'
        CASE 4:    Send_String 0,'Onerror 4: Unknown host'
        CASE 6:    Send_String 0,'Onerror 6: Connection refused'
        CASE 7:    Send_String 0,'Onerror 7: Connection timed out'
        CASE 8:    Send_String 0,'Onerror 8: Unknown connection error'
        CASE 14:  Send_String 0,'Onerror 14: Local port already used'
        CASE 16:  Send_String 0,'Onerror 16: Too many open sockets'
        CASE 17:  Send_String 0,'Onerror 17: Local Port Not Open'
      }
   }
}

2

Re: Telnet into Nion with AMX

Instead of sending the message "reboot" try sending this instead:
shutdown -r now

The NIONs run on Linux so they require a different set of commands to do things. It appears that you have everything pretty much right except for the syntax of the actual command to get it to reboot. Fortunately, Linux is pretty simple and it has built in help menus. Using the command of "shutdown" will shut the unit off, however, you have to tell it when to shutdown, which is why you need the "now" included. Then since you want it to restart after it shuts down, you also need to include the "-r" argument to tell it you really want it to reboot.

Have fun and good luck!

Josh Millward
Burnt Orange Studios

3

Re: Telnet into Nion with AMX

Thanks Josh, but that didn't work either.  I've also tried sending a carriage return first, with the 'root' command, without the 'root' command, 'shutdown -r now' does not work either.  I'm able to telnet into other devices with AMX, but having no luck talking to the Nion...

4

Re: Telnet into Nion with AMX

Do you have the Telnet service turned on?

To test this, can you use something like puTTY to establish a Telnet session with the NION on port 23, log in, type in the reboot command: "shutdown -r now" and have it actually work?

I guess we should make sure everything else is working correctly before adding the complexity of using an automated system to do this.

Josh Millward
Burnt Orange Studios

5

Re: Telnet into Nion with AMX

Yes, it is turned on.  I can telnet in with both putty and a telnet session from a command prompt.  I know the port is open in AMX because when I reboot the Noon (any other way  while the AMX port is open) AMX notifies me that the port has gone offline.

6

Re: Telnet into Nion with AMX

Pardon the spelling on the last post, in a moving car at the time....  I know the port is open in AMX because when I reboot the Nion (either by front panel or through the web interface), AMX notifies me that the port has gone offline.

7

Re: Telnet into Nion with AMX

So when you are using puTTY or Windows Telnet and are connected to the NION, can you enter the command listed above and have the NION reboot?

That may be the fastest way to sort out the correct syntax of the shutdown command for your application.

Josh Millward
Burnt Orange Studios

8

Re: Telnet into Nion with AMX

Yes, using puTTY or Windows Telnet, I can issue the command "shutdown -r now" and reboot the Nion.

9

Re: Telnet into Nion with AMX

I’ve confirmed that this process works on another NION in my office.

Let me ask the same question that Josh asked, because many others get this confused.  But first, since the forum is a teaching device, let me make sure everyone understands the process.

When controlling the NION audio using external control (AMX, for example), port 1632 is used.  NEVER is port 23 used, because Linux will process the incoming command instead of passing the command to pion-d (the NION application).  So when AMX is controlling the NION, an offline port would almost always be the controlling 1632 telnet port.

So now let us talk about port 23, which is by all definitions (Linux, Apple OS, and Windows; but mostly because we are using the TCP/IP stack) the telnet port.  Because we don't use a password other than root (since we would need to publish the password, it would be an open secret, so why even bother with a password), a different process is required to safeguard the telnet path to the Linux kernel.  This is done by disabling port 23 using the web-interface or front panel.  Because both the browser page and the front panel can be made very secure using user defined passwords, the open telnet port 23 (no unique password required) can also be made secure.

However, providing this level of security for the NION creates a common mistake for external control; port confusion.

So though you show in your AMX command set that you are starting a telnet session using port 23, are you sure that this really happens?  Are you sure that when AMX reports the NION going off-line, that it is port 23, and not port 1632?

Again, this function is working fine here, so we are just trying to figure out what is going wrong.

Fergy

BTW, I have to ask, what is monitoring the AMX for proper performance?  Do you want the NION to do it?

Make it intuitive, never leave them guessing.

10

Re: Telnet into Nion with AMX

I guess I should have refreshed to see if you had posted this morning....

Does anyone with more experience with AMX see what could be wrong with the command script that the AMX is running?

Make it intuitive, never leave them guessing.

11

Re: Telnet into Nion with AMX

Fergy, thanks for jumping in on this post.  When you say you confirmed that this process works on another NION in your office, is that with AMX code or with puTTY/telnet.  Security is not an issue, the Nions are on their own network and not connected to the internet.  Maybe I should try to use port 1632.  I thought this port was for RATC and that the shutdown -r now was only available through telnet.

12

Re: Telnet into Nion with AMX

Confirmed with a PC telnet session (HyperTerminal).

Stay with port 23, as the command must go to Linux, which does not "listen" to port 1632.

But maybe I've been asking the wrong question; why is this needed?

Make it intuitive, never leave them guessing.

13

Re: Telnet into Nion with AMX

On occasion, one of our Nions, (we have five is the system), may go into a fault with the error "6 DSP's expected, but only 5 found".  We have yet to find the problem causing the fault.  In any case, if this happens in the middle of the night, we would like to be able to do an unattended reboot of the Nions.  I thought this might be a more graceful way to come out of a fault then using power relays.

14

Re: Telnet into Nion with AMX

Hmmm... something is causing one of the DSP's to fault. That is very strange.

Certainly, if restarting the NION always works, there is no reason you can not do this.

As it has been described, it should work just fine. I'm at a loss as to why it is not working with the AMX system yet you can type it in manually and have it work just fine. I'm guessing there is something about the AMX system logging in correctly and passing the appropriate <CR> or other commands as needed.

Is there a way for you to see any feedback from the NION?

You know, I'm looking for a way to insure that everything is connecting as expected. You should get the prompt sent to you to log in before you send the log in information. Once you are correctly logged in, you should get a command prompt before you issue the command to reboot.

Is there any way you can see this stuff?

Josh Millward
Burnt Orange Studios

15

Re: Telnet into Nion with AMX

When I open the port from AMX with the  "IP_CLIENT_OPEN" command, the response I'm getting from the Nion is
$FF$FD$18$FF$FD $FF$FD#$FF$FD'

16

Re: Telnet into Nion with AMX

I'm not sure what to tell you then.

You saw it work with a Telnet client.

It looks like your AMX is not interpreting the messages from the NION correctly. Since I don't know anything about AMX, I'm at a loss as to why.

Josh Millward
Burnt Orange Studios

17

Re: Telnet into Nion with AMX

you need to implement Telnet negotiation. it's doable smile
google for more info.

if you telnet with putty, the putty client sends stuff like FF FC 18 FF FB 20 ...  to the Telnet server first, and after the negotiation it sends the 'reboot' bytes and carriage return

this negotiation is a must for most telnet servers!

Last edited by zerkalo (2014-10-23 06:46:56)

18

Re: Telnet into Nion with AMX

Over the weeks, I've tried so many variations with no ability to talk to the Nions from AMX via telnet.  I finally just wrote a program to monitor the com port that AMX is connected to on the PC running Nware, that in turn runs a script file that will open up a telnet session and reboot the Nions.  I ended up going around the block to get next door!  Thanks for your suggestions.