Ping Check/Uptime chart logic (How PING is happening from server to Device): reg

131 views
Skip to first unread message

Manukumar NM

unread,
Jul 13, 2023, 11:06:04 PM7/13/23
to open...@googlegroups.com
Greetings...
                   According to this logic in openwisp2 for uptime chart,                             DEFAULT_PING_CHECK_CONFIG = { 'count': { 'type''integer''default': 5, 'minimum': 2, # chosen to avoid slowing down the queue 'maximum': 20, }, 'interval': { 'type''integer''default': 25, 'minimum': 10, # chosen to avoid slowing down the queue 'maximum': 1000, }, 'bytes': {'type''integer''default': 56, 'minimum': 12, 'maximum': 65508}, 'timeout': { 'type''integer''default': 800, 'minimum': 5, # arbitrary chosen to avoid slowing down the queue 'maximum': 1500, }, } 

1. If I am  not wrong, the uptime chart is nothing but a PING check chart ryt.        2. If you see the above logic every 2.5 milliseconds ping is happening from server to connected device (router) to check if the device is pingable or not.      3. If it is correct then,  Per minute 2400 times ping will happen according to your logic (Interval =25, Ping check per min = 60000/interval) .
 If all the above mentioned points are correct means then the data on the devices will be used for ping check, so it would consume more data from device SIM.  Because of that SIM data is closing very fast. 

Is there any specific reason to ping every 2.5 millisecond? or else my understanding is wrong. or what's the use of above PING check logic. 

Thanks in advance for your valuable time and support to understand this openwisp2.
image.png

Federico Capoano

unread,
Jul 14, 2023, 10:08:10 AM7/14/23
to open...@googlegroups.com
Hi Manukumar,

All active checks are executed by default every 5 minutes, this is controlled by the CELERY_BEAT_SCHEDULE settings (look for this setting in the README and in the code and additionally look for celery-beat in the celery docs for more info about this).

The default ping check config you mention is another thing:

DEFAULT_PING_CHECK_CONFIG = {
    'count': {
        'type': 'integer',
        'default': 5,
        'minimum': 2,
        # chosen to avoid slowing down the queue
        'maximum': 20,
    },
    'interval': {
        'type': 'integer',
        'default': 25,
        'minimum': 10,
        # chosen to avoid slowing down the queue
        'maximum': 1000,
    },
    'bytes': {'type': 'integer', 'default': 56, 'minimum': 12, 'maximum': 65508},
    'timeout': {
        'type': 'integer',
        'default': 800,
        'minimum': 5,
        # arbitrary chosen to avoid slowing down the queue
        'maximum': 1500,
    },
}


This is the schema for the arguments passed to the fping command.
Use fping --help to find out more about these arguments:

Probing options:
   -4, --ipv4         only ping IPv4 addresses
   -6, --ipv6         only ping IPv6 addresses
   -b, --size=BYTES   amount of ping data to send, in bytes (default: 56)
   -B, --backoff=N    set exponential backoff factor to N (default: 1.5)
   -c, --count=N      count mode: send N pings to each target
   -f, --file=FILE    read list of targets from a file ( - means stdin)
   -g, --generate     generate target list (only if no -f specified)
                      (give start and end IP in the target list, or a CIDR address)
                      (ex. fping -g 192.168.1.0 192.168.1.255 or fping -g 192.168.1.0/24)
   -H, --ttl=N        set the IP TTL value (Time To Live hops)
   -I, --iface=IFACE  bind to a particular interface
   -l, --loop         loop mode: send pings forever
   -m, --all          use all IPs of provided hostnames (e.g. IPv4 and IPv6), use with -A
   -M, --dontfrag     set the Don't Fragment flag
   -O, --tos=N        set the type of service (tos) flag on the ICMP packets
   -p, --period=MSEC  interval between ping packets to one target (in ms)
                      (in loop and count modes, default: 1000 ms)
   -r, --retry=N      number of retries (default: 3)
   -R, --random       random packet data (to foil link data compression)
   -S, --src=IP       set source address
   -t, --timeout=MSEC individual target initial timeout (default: 500 ms,
                      except with -l/-c/-C, where it's the -p period up to 2000 ms)

Output options:
   -a, --alive        show targets that are alive
   -A, --addr         show targets by address
   -C, --vcount=N     same as -c, report results in verbose format
   -D, --timestamp    print timestamp before each output line
   -e, --elapsed      show elapsed time on return packets
   -i, --interval=MSEC  interval between sending ping packets (default: 10 ms)
   -n, --name         show targets by name (-d is equivalent)
   -N, --netdata      output compatible for netdata (-l -Q are required)
   -o, --outage       show the accumulated outage time (lost packets * packet interval)
   -q, --quiet        quiet (don't show per-target/per-ping results)
   -Q, --squiet=SECS  same as -q, but show summary every n seconds
   -s, --stats        print final stats
   -u, --unreach      show targets that are unreachable
   -v, --version      show version
   -x, --reachable=N  shows if >=N hosts are reachable or not


It's funny because reading the help text again here I found a bug: with interval I really meant to use "period" in the code, but it's using -i (interval) which is only regulating the output, which is not what we want.
Thank you for making me read this code one more time and catch this!

Best regards
Federico Capoano
OpenWISP OÜ
Harjumaa, Tallinn, Sepapaja tn 6, 15551
VAT: EE101989729


--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/CAG6AGHcPWkxOrvmg18cibN_8KoR9kgxyUeqMYosai_BZwGPVbA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages