centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
310 stars 273 forks source link

Digi AnywhereUSB/14 monitoring through SSH CLI #1722

Closed Aleksey-Maksimov closed 9 months ago

Aleksey-Maksimov commented 4 years ago

Monitoring of Digi AnywhereUSB devices via SNMP is very poorly implemented by DIGI. Therefore, I ask you to implement monitoring through SSH

I will give a number of commands that may be useful to us


As I understand it, the last column is the percentage of flash usage:

#> df

Filesys           blocks    used   bsize   files    used
WEB                 1107      42     512     234       2
CFGDATA              984     151     512     630      18

General Information on CPU Utilization and Memory Usage (two identical commands):

#> display device
#> info device

Device Information:

Product              : AnywhereUSB/14
MAC Address          : 00:40:9D:8A:12:22
Firmware Version     : 1.95.21.64 (build 82002081_P awusb14 eos 2/02/2018 8:27:24a)
Boot Version         : 1.09.10.6 (release 82002082_B awusb14 bootloader 11/09/2009)
Post Version         : 1.09.9.39 (release 82001552_A generic_travis hwdiag 11/09/2009)
Product VPD Version  : none
Product ID           : 0x0121
Hardware Strapping   : 0x0000
CPU Utilization      : 2 %
Uptime               : 1 day, 4 hours, 37 minutes, 25 seconds
Total Memory         : 134217728
Used Memory          : 10775620
Free Memory          : 123442108

Full Firmware Version Information:

#> display versions

AnywhereUSB/14:

Component           Part-Number     Release-Tag

BOOT                82002082        release 82002082_B awusb14 bootloader 11/09/2009
POST                82001552        release 82001552_A generic_travis hwdiag 11/09/2009 (V1.09.9.39)
Stored EOS          82002081        build 82002081_P awusb14 eos 2/02/2018 8:27:24a (V1.95.21.64)
Running EOS         82002081        build 82002081_P awusb14 eos 2/02/2018 8:27:24a (V1.95.21.64)
Aleksey-Maksimov commented 4 years ago

List of current connections to USB ports:

#> who

ID  From                   To                     Protocol              Sessions
--  ---------------------  ---------------------  --------------------  --------
1   serial 1               local shell            term
2   local host             192.168.12.15 (Group 4)  Realport USB
3   local host             192.168.0.134 (Group 13)  Realport USB
4   local host             192.168.144.55 (Group 3)  Realport USB
5   local host             192.168.0.135 (Group 14)  Realport USB
6   local host             192.168.0.131 (Group 10)  Realport USB
7   local host             192.168.0.132 (Group 11)  Realport USB
8   local host             192.168.12.16 (Group 5)  Realport USB
9   local host             192.168.0.133 (Group 12)  Realport USB
10  local host             192.168.40.15 (Group 7)  Realport USB
11  192.168.1.100          local host             ssh
12  192.168.1.100          local shell            ssh

It is very important to check the group number here. There are 14 groups in total (1 ... 14). Group numbers must be allowed to be described as a plugin option. For example, by default, all groups from 1 to 14 are checked. If there is no group in the connection list, then this is a problem. We also need to be allowed to select group numbers from the list. For example, if we need to check only some groups of 1,3,5-8 (like --check-usb-groups = '1,3,5-8')

Aleksey-Maksimov commented 4 years ago

Detailed memory usage information:

#> display memory full

Memory Usage:

 Main Memory :
    Total Memory         : 134217728
    Used Memory          : 10788052
    Free Memory          : 123429676

 Network Memory :          Current     Maximum
    Allocated            : 144704      145596
    In use               : 104336      130108
    On recycle lists     : 40368       46340

    Network Resource Item Stats :

            Item | Size | In Use | Allocated | Maximum
         ttTimer |   36 |      4 |         8 |      10
        ttPacket |   48 |     78 |       135 |     135
           ttRte |  116 |      5 |         7 |       7
        ttSocket |  268 |      9 |        10 |      10
       ttTcpVect |  860 |     75 |        82 |      82
         buffers |   32 |      3 |         6 |       9
                     64 |      0 |         2 |       8
                    128 |      2 |         4 |       4
                    256 |     78 |       134 |     134
                    512 |      0 |         1 |       4
                   1024 |      0 |         1 |       1
                   2048 |      2 |         5 |       6
                   4096 |      2 |         4 |       4
                  >4096 |      0 |         0 |       0

 Message Block Stats :

    In Use | Allocated | Maximum | Success | Failure
        29 |        55 |      59 |  635634 |       0

 Data Block Stats :

    Size | In Use | Allocated | Maximum | Success | Failure
      16 |      8 |        44 |      59 |  635111 |       0
      64 |     27 |        27 |      27 |     246 |       0
     128 |      0 |        21 |      22 |     283 |       0
     256 |      0 |         0 |       0 |       0 |       0
     512 |      0 |         0 |       0 |       0 |       0
Aleksey-Maksimov commented 4 years ago

Serial Port Usage Information:

#> display serial

Serial Status:

  Port#   RTS   CTS   DSR   DCD   DTR    RI   OFC   IFC
      1    on   off   off   off    on   off   off   off
#> info serial

Serial port #1 statistics:

rbytes               : 0               tbytes               : 9
overrun errors       : 0               overflow errors      : 0
frame errors         : 0               parity errors        : 0
breaks               : 0

signal changes :      CTS     DSR      RI     DCD     RTS     DTR
                        0       0       0       0       1       1
Aleksey-Maksimov commented 4 years ago

Enabled Services Information:

#> show service

 Service Configuration :

 index state ipport keepalive nodelay dlyd-ack                         service
     1   off      7       off     off      200                TCP Echo Service
     2   off      7        na      na      200                UDP Echo Service
     3    on     22       off     off      200                     SSH Service
     4    on     23       off     off      200                  Telnet Service
    13    on     80        na      na      200                    HTTP Service
    14    on    161        na      na      200                    SNMP Service
     5    on    443        na      na      200                   HTTPS Service
    12    on    771       off      na        5                RealPort Service
     6    on   1027       off      na        5      Encrypted RealPort Service
     7    on   2001       off     off      200          Telnet Server (Port 1)
     8    on   2101       off     off      200             TCP Server (Port 1)
     9    on   2101        na      na      200      Serial/UDP Server (Port 1)
    15    on   2362        na      na      200                    ADDP Service
    10   off   2501       off     off      200             SSH Server (Port 1)
    11    on   2601       off     off      200  Secure Socket Service (Port 1)
    16    on   3422       off      na        5            Anywhere/USB Service
    17    on   3423       off      na        5      Encrypted RealPort Service

Here, I do not understand why the SSH Server service is displayed in the off status Perhaps it makes sense to add an option that allows us to customize the list of services whose status should be "on" Important services for USB ports:

Additionally, you can implement a check for service TCP-listeners (and UDP-listeners)

#> display tcp

 TCP Table:

 Idx   family Recv-Q      Send-Q      LocalAddress          ForeignAddress        Refs State/Backlog RTO/Count
 18    IPV4   0/8192      0/8192      0.0.0.0:22            0.0.0.0:0             2    LISTEN/0      0/0
 19    IPV4   0/8192      0/8192      0.0.0.0:23            0.0.0.0:0             2    LISTEN/0      0/0
 29    IPV4   0/8192      0/8192      0.0.0.0:80            0.0.0.0:0             2    LISTEN/0      0/0
 20    IPV4   0/8192      0/8192      0.0.0.0:443           0.0.0.0:0             2    LISTEN/0      0/0
 25    IPV4   0/8192      0/8192      0.0.0.0:771           0.0.0.0:0             2    LISTEN/0      0/0
 21    IPV4   0/8192      0/8192      0.0.0.0:1027          0.0.0.0:0             2    LISTEN/0      0/0
 22    IPV4   0/8192      0/8192      0.0.0.0:2001          0.0.0.0:0             2    LISTEN/0      0/0
 23    IPV4   0/8192      0/8192      0.0.0.0:2101          0.0.0.0:0             2    LISTEN/0      0/0
 24    IPV4   0/8192      0/8192      0.0.0.0:2601          0.0.0.0:0             2    LISTEN/0      0/0
 26    IPV4   0/8192      0/8192      0.0.0.0:3422          0.0.0.0:0             2    LISTEN/0      0/0
 27    IPV4   0/8192      0/8192      0.0.0.0:3423          0.0.0.0:0             2    LISTEN/0      0/0
...
#> display udp

 UDP Table:

 Index family RecvQ       SendQ       LocalAddress          Refs
 30    IPV4   0/8192      0/8192      0.0.0.0:161           3
 25    IPV4   0/8192      0/8192      0.0.0.0:2362          2
 7     IPV4   0/8192      0/8192      0.0.0.0:3422          3
 9     IPV4   0/8192      0/8192      0.0.0.0:34822         2
 94    IPV4   0/8192      0/8192      0.0.0.0:47452         2
 27    IPV4   0/8192      0/8192      0.0.0.0:47549         2
 28    IPV4   0/8192      0/8192      0.0.0.0:62330         2

Here are the numbers of all ports and their descriptions:

AUSBPorts

Aleksey-Maksimov commented 4 years ago

Network Activity Information:

#> info ethernet if=*
#> info ethernet

Ethernet statistics for eth0:

InBytes              : 59293870        OutBytes             : 46232065
InUcastPkts          : 576238          OutUcastPkts         : 652188
InNonUcastPkts       : 97095           OutNonUcastPkts      : 39
InDiscards           : 0               OutDiscards          : 0
InErrors             : 0               OutErrors            : 0
InUnknownProtos      : 62719
#> info ip

IP statistics:

InReceives           : 571619          OutRequests          : 649253
InAddressErrors      : 4792            DatagramsForwarded   : 0
InHeaderErrors       : 0               OutNoRoutes          : 0
InUnknownProtos      : 52              OutDiscards          : 0
InDiscards           : 0               FragCreates          : 0
ReassembleOks        : 0               FragOks              : 0
ReassembleFails      : 0               FragFails            : 0
#> info icmp

ICMP statistics:

InMessages           : 2549            OutMessages          : 2154
InDestUnreachables   : 0               OutDestUnreachables  : 0
InErrors             : 0
#> info tcp

TCP statistics:

InSegments           : 504209          OutSegments          : 368858
InErrors             : 0               RetransmitSegments   : 127
EstabResets          : 7               OutResets            : 42
PassiveOpens         : 3555            ActiveOpens          : 5
Established          : 62              AttemptFails         : 0
#> info udp

UDP statistics:

InDatagrams          : 5480            OutDatagrams         : 5484
InErrors             : 0               NoPorts              : 24693
Aleksey-Maksimov commented 4 years ago

I am ready to answer your clarifying questions.

garnier-quentin commented 4 years ago

Do you know if there is an option or a command to display output in xml, csv or xml ? The df command result is in bytes ?

Aleksey-Maksimov commented 4 years ago

to display output in xml, csv or xml

I did not find such an option.

The df command result is in bytes

I do not know. The problem is that on the DIGI website I did not find information about the commands. I tried, but the df command does not accept any options.

#> df

Filesys           blocks    used   bsize   files    used
WEB                 1107      42     512     234       2
CFGDATA              984     151     512     630      18

I think the last column shows the percentage of used space. WEB = 2% CFGDATA = 18%

Aleksey-Maksimov commented 1 year ago

I almost stopped believing that the mission is possible ...

Aleksey-Maksimov commented 9 months ago

Duplicated here https://thewatch.centreon.com/ideas/digi-anywhereusb-14-monitoring-through-ssh-cli-2625

fmattesct commented 9 months ago

The Watch duplicate