custom panel network status

hi,

Is there a way to get a warning when the network disconnects on the custom panel? Like a ping?

thanks.

Hi Ferhat,

Can you clarify what you mean by network disconnects? Do you mean a device used in a custom panel loses its connection, or you lose your internet connection?

Hi Aury,

I want to check the connection health of special devices using the Ultrix Matrix. It should alert me when the connection is lost.

I’m using a script like this, but it seems to be causing excessive traffic on the ultrix port.

var checkCount = 0; var lastStatus = "UNKNOWN";
  function checkNetwork() {
    checkCount++;
    var host = "10.90.8.11";
    var port = 80;
    
    ogscript.debug("Manual Check #" + checkCount);
    
    try {
      var startTime = new Date().getTime();
      var socket = new java.net.Socket();
      socket.connect(new java.net.InetSocketAddress(host, port), 3000);
      var endTime = new Date().getTime();
      socket.close();
      
      var ping = endTime - startTime;
      lastStatus = "ONLINE - " + ping + "ms";
      
      // ONLINE - Yeşil tema
      ogscript.setStyle("_top", "bdr:thick;bdr#00FF00;bg#003300;");
      updateButtonStyle("bg#00FF00;fg#003300;bdr:thick;bdr#00FF00;", "✅ ONLINE");
      ogscript.debug("ONLINE - Ping: " + ping + "ms");
      
    } catch (e) {
      lastStatus = "OFFLINE";
      
      // OFFLINE - Kırmızı tema
      ogscript.setStyle("_top", "bdr:thick;bdr#FF0000;bg#330000;");
      updateButtonStyle("bg#FF0000;fg#330000;bdr:thick;bdr#FF0000;", "test");
      ogscript.debug("OFFLINE");
    }
    
    // Status label'ını güncelle
    //updateStatusLabel();
  }
  
  function updateButtonStyle(buttonStyle, buttonText) {
    ogscript.setXML("mainButton", "");
    var newXML = '<table id="mainButton" height="50" left="189" right="181"  name="' + buttonText + '" style="size:20;font:bold;' + buttonStyle + '" top="10" ><tr><param anchor="center" colspan="1" contextid="Ultrix.1" expand="true" fill="both" header="true" height="50" oid="params.frame.time" style="bg#modaloverlay;bdr:shadow;font:bold;size:Bigger;txt-align:center;fg#0CF227;" weightx="1.0" weighty="1.0"><task tasktype="ogscript"><![CDATA[// Clock]]></task></param></tr></table>';
    ogscript.appendXML("_top", newXML);
  }
  
  //function updateStatusLabel() {
   // var statusText = "Last Check: " + lastStatus + "\\nTotal Checks: " + checkCount;
   // ogscript.setXML("statusLabel", "");
   // var newXML = '<label id="statusLabel" height="60" left="50" name="' + statusText + '" style="txt-align:center;bdr:none;bg#000000;fg#FFFFFF;size:12;" top="300" width="300"/>';
   // ogscript.appendXML("_top", newXML);
    
  //}</api>
  <ogscript handles="onload">ogscript.debug("COLOR CHANGING BUTTON MONITOR STARTED");
  checkNetwork();</ogscript>