Skip to content

Check: Socket

Socket checks a local or remote TCP socket with the following criterions :

  • for local, check if LISTEN socket is present
  • for local and remote, count ESTABLISHED
  • for remote, or if connect option is given, try to connect

This check can be used to monitor remote process network availability, and count how many sockets are currently in use for some protocols.


       socket       : local tcp port | remote host tcp port
       connect      : yes/no ; default no for local, yes for remote


        socket: local tcp 6379
        connect: yes

        socket: remote tcp 443
        connect: yes


This check sends an alert if a local socket is not in LISTEN state, or if a socket refuse connection.

Output to Metrology

This module sends one message for each socket, with the following fields:

cmt_socket_name      : string
cmt_socket_type      : local/remote
cmt_socket_proto     : tcp/udp
cmt_socket_host      : host:port
cmt_socket_count     : int (established)
cmt_socket_alive     : yes/no  [LISTEN]
cmt_socket_ping      : ok/nok

CLI usage and output

$ ./ socket

Check socket 
cmt_socket_name          redis
cmt_socket_port          6379
cmt_socket_type          local
cmt_socket_proto         tcp
cmt_socket_alive         yes
cmt_socket_count         0
OK                       local redis localhost tcp/6379 - alive: yes - count: 0

Check socket 
cmt_socket_name          google
cmt_socket_port          443
cmt_socket_type          local
cmt_socket_proto         tcp
cmt_socket_count         0
cmt_socket_alive         yes
OK                       remote google tcp/443 - alive: yes - count: 0