eping 4.1__tar.gz → 4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eping
3
- Version: 4.1
3
+ Version: 4.2
4
4
  Summary: Continuous ICMP reachability monitor built on fping, with a CSV logfile analyser (epinga)
5
5
  Author-email: Ewald Jeitler <ewald@jeitler.cc>
6
6
  License: GPL-3.0-or-later
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Dynamic: license-file
19
19
 
20
- # eping.py 4.01
20
+ # eping.py 4.02
21
21
 
22
22
  Continuous ICMP reachability monitor built on `fping`. Scans a host list in a loop,
23
23
  reports each host UP/DOWN/NO-DNS, counts state changes. CLI (curses) or web GUI.
@@ -235,8 +235,8 @@ Single self-contained page, no external resources.
235
235
 
236
236
  - Table: CLI-style columns, filled top-down then next column right. Horizontal scroll
237
237
  if needed ("SCROLL RIGHT FOR MORE" hint in the stats bar).
238
- - Footer stats: HOSTS, RUNTIME, HOST UP/DOWN/FLAPPING, for the whole current view regardless
239
- of the match filter and the ADV FILTER (HOSTS-SHOWN = shown count). The CLI footer counts the same way. RUNTIME shows `n/a` briefly during a background round.
238
+ - Footer stats: HOSTS, RUNTIME, HOST UP/DOWN/FLAPPING always count all hosts; SHOWN is the
239
+ number of rows displayed after the view, the match filter and the ADV FILTER. The CLI footer counts the same way. RUNTIME shows `n/a` briefly during a background round.
240
240
  - Adding many hosts (`ADD`, ADD HOSTS FILE, upload) shows "added N host(s) - please wait,
241
241
  pinging ..." until they appear with a state, then `done`.
242
242
  - Font size 6–28px (slider, `A−`/`A+`, `+`/`−` keys), stored in `localStorage`.
@@ -1,4 +1,4 @@
1
- # eping.py 4.01
1
+ # eping.py 4.02
2
2
 
3
3
  Continuous ICMP reachability monitor built on `fping`. Scans a host list in a loop,
4
4
  reports each host UP/DOWN/NO-DNS, counts state changes. CLI (curses) or web GUI.
@@ -216,8 +216,8 @@ Single self-contained page, no external resources.
216
216
 
217
217
  - Table: CLI-style columns, filled top-down then next column right. Horizontal scroll
218
218
  if needed ("SCROLL RIGHT FOR MORE" hint in the stats bar).
219
- - Footer stats: HOSTS, RUNTIME, HOST UP/DOWN/FLAPPING, for the whole current view regardless
220
- of the match filter and the ADV FILTER (HOSTS-SHOWN = shown count). The CLI footer counts the same way. RUNTIME shows `n/a` briefly during a background round.
219
+ - Footer stats: HOSTS, RUNTIME, HOST UP/DOWN/FLAPPING always count all hosts; SHOWN is the
220
+ number of rows displayed after the view, the match filter and the ADV FILTER. The CLI footer counts the same way. RUNTIME shows `n/a` briefly during a background round.
221
221
  - Adding many hosts (`ADD`, ADD HOSTS FILE, upload) shows "added N host(s) - please wait,
222
222
  pinging ..." until they appear with a state, then `done`.
223
223
  - Font size 6–28px (slider, `A−`/`A+`, `+`/`−` keys), stored in `localStorage`.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eping"
7
- version = "4.01"
7
+ version = "4.02"
8
8
  description = "Continuous ICMP reachability monitor built on fping, with a CSV logfile analyser (epinga)"
9
9
  readme = "README.md"
10
10
  license = { text = "GPL-3.0-or-later" }
@@ -7,7 +7,7 @@
7
7
  # I knew how it worked.
8
8
  # Now, only god knows it!
9
9
  # - - - - - - - - - - - - - - - - - - - - - - - -
10
- VERSION = '4.01'
10
+ VERSION = '4.02'
11
11
  version = VERSION # legacy alias (kept for existing references)
12
12
 
13
13
  # --- scaling limits ---
@@ -1716,6 +1716,13 @@ def view_hosts(mode, hosts, host_state, tz_offset, flap_window=FLAP_WINDOW_DEF):
1716
1716
  return hosts
1717
1717
  return filter_hosts(mode, hosts, host_state, tz_offset, flap_window)
1718
1718
 
1719
+ def view_rows(rows, mode, host_state, tz_offset, flap_window=FLAP_WINDOW_DEF):
1720
+ """Rows (from build_display) of the hosts shown by the view 'mode' (live)."""
1721
+ if mode <= 0:
1722
+ return rows
1723
+ keep = set(filter_hosts(mode, [r[0] for r in rows], host_state, tz_offset, flap_window))
1724
+ return [r for r in rows if r[0] in keep]
1725
+
1719
1726
  def filter_hosts(mode, original_hosts_list, host_state, tz_offset,
1720
1727
  flap_window=FLAP_WINDOW_DEF, up_seen=None):
1721
1728
  """Host list for the given view mode - a snapshot, taken when the view switches.
@@ -3433,7 +3440,7 @@ WEB_INDEX_HTML = r"""<!DOCTYPE html>
3433
3440
  <span id="ctrls">
3434
3441
  <span class="ctrls-row" id="ctrlsRow1">
3435
3442
  <span id="ctrlsMain">
3436
- <select id="selFilter" title="choose which hosts are shown and pinged - a host outside the current view is not checked until a view including it is selected again">
3443
+ <select id="selFilter" title="display filter: choose which hosts are shown (evaluated live) - all hosts keep being pinged until SET REFERENCE removes the hosts that are not shown">
3437
3444
  <option value="0">ALL HOSTS</option>
3438
3445
  <option value="1">CURRENTLY-UP</option>
3439
3446
  <option value="3">ALWAYS-UP</option>
@@ -3451,7 +3458,7 @@ WEB_INDEX_HTML = r"""<!DOCTYPE html>
3451
3458
  <option value="3">FLAP/UP/DOWN</option>
3452
3459
  <option value="4">FLAP/DOWN/UP</option>
3453
3460
  </select>
3454
- <button id="btnSetRef" title="use the hosts currently shown as the new reference list">SET REFERENCE</button>
3461
+ <button id="btnSetRef" title="use the hosts currently shown as the new reference list - all other hosts are removed and no longer pinged">SET REFERENCE</button>
3455
3462
  <button id="btnZero" title="reset CH-TIME and CH NO for all hosts">ZERO CHANGES</button>
3456
3463
  <button id="btnClear" class="danger" title="remove every host from the list, resets all state">CLEAR ALL</button>
3457
3464
  <select id="selAddrMode" title="Deduplication when the same host is entered as both a hostname and its IP: hostname &amp; ip keeps both as given (no dedup) | prefer hostname: skip a raw IP already covered by a hostname | prefer ip address: skip a hostname already covered by a raw IP | ip only: resolve every hostname to its IP and ping/track it by address">
@@ -3524,8 +3531,8 @@ WEB_INDEX_HTML = r"""<!DOCTYPE html>
3524
3531
  <span class="u">HOSTS-UP: <b id="sUp">0</b></span>
3525
3532
  <span class="d">HOSTS-DOWN: <b id="sDown">0</b></span>
3526
3533
  <span>FLAPPING: <b id="sFlap">0</b></span>
3527
- <span title="hosts matching the display filter, out of the totals above"
3528
- id="sShownWrap">HOSTS-SHOWN: <b id="sShown">0</b></span>
3534
+ <span title="hosts shown by the view and display filters, out of all hosts"
3535
+ id="sShownWrap">SHOWN: <b id="sShown">0</b></span>
3529
3536
  <span id="sLog"></span>
3530
3537
  <span class="msg" id="msg"></span>
3531
3538
  <span id="scrollHint"></span>
@@ -5606,7 +5613,7 @@ function poll(){
5606
5613
  document.getElementById('sFlap').textContent = s.hosts_flap;
5607
5614
  var swrap = document.getElementById('sShownWrap');
5608
5615
  var advOn = !!(s.adv_filter && Object.keys(s.adv_filter).length);
5609
- swrap.style.display = (s.match_filter || advOn) ? '' : 'none';
5616
+ swrap.style.display = ''; // SHOWN is always visible
5610
5617
  lastAdv = {values: s.adv_values || {}, filter: s.adv_filter || {}};
5611
5618
  document.getElementById('btnAdvFilter').className = advOn ? 'on' : '';
5612
5619
  document.getElementById('sShown').textContent = s.hosts_shown;
@@ -7736,10 +7743,13 @@ def run_web_mode(original_hosts_list, host_state, args, logfile_file_name,
7736
7743
  if cmds or gn_just_finished:
7737
7744
  # view and order are pure display changes - show them at once instead of
7738
7745
  # letting the browser wait for the running round, same as the CLI does
7739
- quick = build_display(view_hosts(filter_mode, active_hosts_list, host_state, tz_offset, flap_window), host_state, sort_mode,
7740
- tz_offset, flap_window)
7741
- quick_up = sum(1 for e in quick if 'UP' in e[1])
7742
- quick_total = len(quick)
7746
+ # HOSTS / HOSTS-UP / HOSTS-DOWN count all hosts, the view and the display
7747
+ # filters only narrow what is SHOWN
7748
+ quick_all = build_display(active_hosts_list, host_state, sort_mode,
7749
+ tz_offset, flap_window)
7750
+ quick_up = sum(1 for e in quick_all if 'UP' in e[1])
7751
+ quick_total = len(quick_all)
7752
+ quick = view_rows(quick_all, filter_mode, host_state, tz_offset, flap_window)
7743
7753
  if match_filter_re is not None or adv_filter:
7744
7754
  quick = apply_match_filter(quick, match_filter_re)
7745
7755
  with web_lock:
@@ -7836,16 +7846,15 @@ def run_web_mode(original_hosts_list, host_state, args, logfile_file_name,
7836
7846
  phase['state'] = time.time() - _t
7837
7847
 
7838
7848
  _t = time.time()
7839
- display_list = build_display(view_hosts(filter_mode, active_hosts_list, host_state, tz_offset, flap_window), host_state, sort_mode,
7840
- tz_offset, flap_window)
7841
- # HOSTS/HOSTS-UP/HOSTS-DOWN are the totals for the whole current view - a
7842
- # [M] display filter narrows what's SHOWN, not what's actually being pinged,
7843
- # so it must not make these look like only 2 hosts exist. hosts_count_shown
7844
- # is the post-filter count, reported separately (HOSTS-SHOWN in the web GUI).
7845
- hosts_count_up = sum(1 for e in display_list if 'UP' in e[1])
7846
- hosts_count_down = len(display_list) - hosts_count_up
7847
- hosts_count_flap = sum(1 for e in display_list
7849
+ display_all = build_display(active_hosts_list, host_state, sort_mode,
7850
+ tz_offset, flap_window)
7851
+ # HOSTS/HOSTS-UP/HOSTS-DOWN/FLAPPING count all hosts - the view and the [M] /
7852
+ # ADV display filters only narrow what is SHOWN (hosts_count_shown below).
7853
+ hosts_count_up = sum(1 for e in display_all if 'UP' in e[1])
7854
+ hosts_count_down = len(display_all) - hosts_count_up
7855
+ hosts_count_flap = sum(1 for e in display_all
7848
7856
  if host_is_flapping(e, now_local(tz_offset), flap_window))
7857
+ display_list = view_rows(display_all, filter_mode, host_state, tz_offset, flap_window)
7849
7858
  if match_filter_re is not None or adv_filter:
7850
7859
  display_list = apply_match_filter(display_list, match_filter_re)
7851
7860
  hosts_count_shown = len(display_list)
@@ -9773,6 +9782,7 @@ if __name__=='__main__':
9773
9782
  hosts_count_up = 0
9774
9783
  hosts_count_down = 0
9775
9784
  hosts_count_flap = 0
9785
+ hosts_count_shown = 0
9776
9786
  run_time = '0.00'
9777
9787
  phase = {}
9778
9788
  used_scan = ''
@@ -9826,7 +9836,7 @@ if __name__=='__main__':
9826
9836
  # mirror the same fix as run_web_mode(): HOSTS-UP/DOWN in the web view should
9827
9837
  # be the totals for the current view, not narrowed by the [M] display filter
9828
9838
  # the way the curses screen's own hosts_count_up/down are (left untouched here).
9829
- total_list = build_display(view_hosts(filter_mode, active_hosts_list, host_state, tz_offset, flap_window), host_state, sort_mode,
9839
+ total_list = build_display(active_hosts_list, host_state, sort_mode,
9830
9840
  tz_offset, flap_window)
9831
9841
  total_up = sum(1 for e in total_list if 'UP' in e[1])
9832
9842
  total_down = len(total_list) - total_up
@@ -9855,17 +9865,20 @@ if __name__=='__main__':
9855
9865
  so they can take effect at once instead of after the next scan round.
9856
9866
  """
9857
9867
  global display_list, hosts_count_up, hosts_count_down, hosts_count_flap
9858
- display_list = build_display(view_hosts(filter_mode, active_hosts_list, host_state, tz_offset, flap_window), host_state, sort_mode,
9859
- tz_offset, flap_window)
9860
- # HOSTS/UP/DOWN/FLAPPING are the totals of the whole view - [M] and ADV FILTER
9861
- # only narrow what is shown, every host is still pinged
9868
+ global hosts_count_shown
9869
+ display_all = build_display(active_hosts_list, host_state, sort_mode,
9870
+ tz_offset, flap_window)
9871
+ # HOSTS/UP/DOWN/FLAPPING count all hosts - the view, [M] and ADV FILTER only
9872
+ # narrow what is shown (SHOWN), every host is still pinged
9862
9873
  _now_ref = now_local(tz_offset)
9863
- hosts_count_up = sum(1 for e in display_list if 'UP' in e[1])
9864
- hosts_count_down = len(display_list) - hosts_count_up
9865
- hosts_count_flap = sum(1 for e in display_list
9874
+ hosts_count_up = sum(1 for e in display_all if 'UP' in e[1])
9875
+ hosts_count_down = len(display_all) - hosts_count_up
9876
+ hosts_count_flap = sum(1 for e in display_all
9866
9877
  if host_is_flapping(e, _now_ref, flap_window))
9878
+ display_list = view_rows(display_all, filter_mode, host_state, tz_offset, flap_window)
9867
9879
  if match_filter_re is not None or adv_filter:
9868
9880
  display_list = apply_match_filter(display_list, match_filter_re)
9881
+ hosts_count_shown = len(display_list)
9869
9882
 
9870
9883
  def draw_screen():
9871
9884
  """Paint the whole screen from the data of the last completed round.
@@ -9985,11 +9998,13 @@ if __name__=='__main__':
9985
9998
  screen_output(rows - 1, 67, 'DOWN: ', 1, 1)
9986
9999
  screen_output(rows - 1, 73, hosts_down, 3, 1)
9987
10000
  screen_output(rows - 1, 79, 'FLAPPING: ', 1, 1)
9988
- screen_output(rows - 1, 89, hosts_flap.rstrip() + ' |', 1, 1)
10001
+ screen_output(rows - 1, 89, hosts_flap.rstrip(), 1, 1)
10002
+ screen_output(rows - 1, 96, 'SHOWN: ', 1, 1)
10003
+ screen_output(rows - 1, 103, ('{m: <6}'.format(m=hosts_count_shown)).rstrip() + ' |', 1, 1)
9989
10004
  if args.disable_logging:
9990
- screen_output(rows - 1, 99, 'LOGGING-ON: ' + logfile_file_name, 1, 1)
10005
+ screen_output(rows - 1, 113, 'LOGGING-ON: ' + logfile_file_name, 1, 1)
9991
10006
  else:
9992
- screen_output(rows - 1, 99, 'LOGGING-OFF', 1, 1)
10007
+ screen_output(rows - 1, 113, 'LOGGING-OFF', 1, 1)
9993
10008
  if num_of_hosts > 0 and maxhosts < num_of_hosts:
9994
10009
  tts_text = ' | TERMINAL TOO SMALL '
9995
10010
  screen_output(rows - 1, cols - len(tts_text), tts_text, 3, 2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eping
3
- Version: 4.1
3
+ Version: 4.2
4
4
  Summary: Continuous ICMP reachability monitor built on fping, with a CSV logfile analyser (epinga)
5
5
  Author-email: Ewald Jeitler <ewald@jeitler.cc>
6
6
  License: GPL-3.0-or-later
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Dynamic: license-file
19
19
 
20
- # eping.py 4.01
20
+ # eping.py 4.02
21
21
 
22
22
  Continuous ICMP reachability monitor built on `fping`. Scans a host list in a loop,
23
23
  reports each host UP/DOWN/NO-DNS, counts state changes. CLI (curses) or web GUI.
@@ -235,8 +235,8 @@ Single self-contained page, no external resources.
235
235
 
236
236
  - Table: CLI-style columns, filled top-down then next column right. Horizontal scroll
237
237
  if needed ("SCROLL RIGHT FOR MORE" hint in the stats bar).
238
- - Footer stats: HOSTS, RUNTIME, HOST UP/DOWN/FLAPPING, for the whole current view regardless
239
- of the match filter and the ADV FILTER (HOSTS-SHOWN = shown count). The CLI footer counts the same way. RUNTIME shows `n/a` briefly during a background round.
238
+ - Footer stats: HOSTS, RUNTIME, HOST UP/DOWN/FLAPPING always count all hosts; SHOWN is the
239
+ number of rows displayed after the view, the match filter and the ADV FILTER. The CLI footer counts the same way. RUNTIME shows `n/a` briefly during a background round.
240
240
  - Adding many hosts (`ADD`, ADD HOSTS FILE, upload) shows "added N host(s) - please wait,
241
241
  pinging ..." until they appear with a state, then `done`.
242
242
  - Font size 6–28px (slider, `A−`/`A+`, `+`/`−` keys), stored in `localStorage`.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes