Home AMX User Forum NetLinx Studio
Options

Host(s) on line

Is there a way to simulate a ICMP PING like the command on telnet ?
I need to keep track of a few (non AMX) terminal on a LAN using a NetLinx system. I need to ping each host evry n seconds and check if I can get an answer.
There is a possibility to use IP_CLIENT_OPEN command and see the response but wich port do I need to use ? The 23 ? And what about if the terminal doesn't use the telnet service ?
Hi and thanks to all,
Fabrizio.

Comments

  • Options
    maxifoxmaxifox Posts: 209
    Re: Host(s) on line

    Interesting question, I am looking for that as well. From my knowledge, it is currently impossible since AMX does not have ICMP related stuff open for Netlinx developing (please correct me if I am wrong). Using IP_CLIENT_OPEN will not help, since it operates with TCP and UDP but not ICMP.

    ICMP is based on IP but as the protocol it is different from TCP and UDP. ICMP does not operate with ports but rather with "types" and "codes".

    As a workaround you may use a third-party system (regular computer on the net) which can use ping feature and reply you back with the result via TCP.
  • Options
    There is another option.

    Use IP_CLIENT_OPEN to url 'localhost' (i.e. 127.0.0.1) and port 23 (or the current Telnet port of the master). This will open a telnet session between the master and the NetLinx local port. Then using SEND_STRING you can issue a ping to an IP/URL using the telnet session to do the work. Use a DATA_EVENT to parse the return string response from the telnet session.

    If telnet security is on, NetLinx will be prompted to login and you will have to code an appropriate user and password to login with.

    Also remember that there is a limited number of telnet sessions the master will accept (current firmware is 4 but earlier versions were limited to 2).

    HTH,

    Chuck
  • Options
    frthomasfrthomas Posts: 176
    Chuck method is interresting; nice hack.

    Fabrizio, what are your hosts and what is the purpose of pinging them? On most Unix systems there is a TCP echo function (port 7) that you could maybe use (must be enabled on the hosts). If the hosts are computers, maybe you could create a small program that sends the hostname of the computer to a given port of the master (using UDP).

    If the hosts are generic hardware devices, then it is harder and you may want to investigate what protocol they operate and try to implement part of it on the master (may be as simple as connecting to a port you know the device uses).

    Any of these methods would give you a better status on the hosts than ping. Ping is fairly low level and is mostly useful in diagnosing the network, not the hosts. As a case in point, Netlinx masters may be completely locked up but still reply to ping.

    HTH

    Fred
  • Options
    maxifoxmaxifox Posts: 209
    Below is a note from our experienced system administrator. Hope this give us some clarification...

    "I haven't seen anyone using UNIX echo service for a long time now.

    Basically there are two levels of checking the remote host.

    1. Using ICMP ping. This one just tells you if the host is up. Before
    counting on ICMP ping make sure that ICMP is not firewalled anywhere
    between remote machien and yours. Some providers do that.

    2. Application level. Check for the known response from an application
    running on a remote machine. For example, send HTTP query to port 80 of
    a remote machine and make sure that returned result contains string
    "Copyright 2004, Thunderworx Ltd.". This way you will know for sure
    that the machine is up and that is doing what it is supposed to do.
    With ping this is not possible. For example, machine can crash but
    still respond to ICMP pings. Or the web server on which you are relying
    is dead, or the website that you must provide was accidentally deleted,
    etc.

    There is also an SNMP (Simple Network Management Protocol) protocol
    which covers the needs of monitoring and administration. It allows you
    to monitor all sorts of information, from the amount of
    incoming/outgoing traffic on a specified interface, to CPU load, to
    custom queries, like number of SQL queries at any given moment in time."
  • Options
    frthomasfrthomas Posts: 176
    SNMP is nice but it also needs a deamon (i.e. specific software running on the machine) and while I believe a client for Netlinx is possible, it is a major effort.

    Agreed TCP echo is kind of an old thing. But it is very lightweight and simple.

    Anyway, what to do really all depends on the hosts Fabrizio wants to monitor...

    Fred
  • Options
    maxifoxmaxifox Posts: 209
    Originally posted by frthomas

    Anyway, what to do really all depends on the hosts Fabrizio wants to monitor...

    Yes, I agree, this is the starting point for all further considerations.
  • Options
    Thanks

    Hi all,
    thanks you for the really interesting and useful suggestions !
    I think I'll use the LOCAL TELNET method like Chuck wrote. It is exactly what I tried to do. The only one method I can use is the ICMP Ping because I don't know exactly the END POINTS kind, I know only the IP adresses, so I'm not sure if I can open Telnet or trust the port 7 for a reply. I need just to know if the END POINTS are ON-LINE and write it down on a FILE stored in the NetLinx "HardDisk" as well as other system information ( a LOG FILE).
    Thank you again,
    Fabrizio.
Sign In or Register to comment.