eping 4.5__tar.gz → 4.7__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.5
3
+ Version: 4.7
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.05
20
+ # eping.py 4.07
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.
@@ -1,4 +1,4 @@
1
- # eping.py 4.05
1
+ # eping.py 4.07
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.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eping"
7
- version = "4.05"
7
+ version = "4.07"
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.05'
10
+ VERSION = '4.07'
11
11
  version = VERSION # legacy alias (kept for existing references)
12
12
 
13
13
  # --- scaling limits ---
@@ -956,7 +956,7 @@ def ssh_apply_pending():
956
956
  return
957
957
  old = SOURCE_LABEL
958
958
  ssh_activate(p if p is not False else None)
959
- _source_events.append('SOURCE SWITCH %s -> %s' % (old, SOURCE_LABEL))
959
+ _source_events.append((get_date_time(), 'SOURCE SWITCH %s -> %s' % (old, SOURCE_LABEL)))
960
960
 
961
961
  def ssh_init(target, key, hostkey='accept-new', resolve=True):
962
962
  """-ssh at startup: ask for the secret, trust the host key (ssh's own prompt), verify
@@ -1065,8 +1065,8 @@ def source_set(down, reason=''):
1065
1065
  if down != _source_down:
1066
1066
  _source_down = down
1067
1067
  # logged as a comment row (shown in epinga.py's comment timeline)
1068
- _source_events.append(('JUMPHOST %s OFFLINE: %s' % (SOURCE_LABEL, reason)) if down
1069
- else ('JUMPHOST %s ONLINE again' % SOURCE_LABEL))
1068
+ _source_events.append((get_date_time(), ('JUMPHOST %s OFFLINE: %s' % (SOURCE_LABEL, reason)) if down
1069
+ else ('JUMPHOST %s ONLINE again' % SOURCE_LABEL)))
1070
1070
 
1071
1071
  _fping_caps = None
1072
1072
  def fping_capabilities():
@@ -2624,7 +2624,7 @@ def update_host_state(host_state, fping_result_data_sorted, tz_offset,
2624
2624
  now_str = get_date_time()
2625
2625
  while _source_events:
2626
2626
  _ev = _source_events.pop(0)
2627
- write_log_comment(logging_enabled, logfile_file_name, _ev, tz_offset) # shown in the report's comment timeline
2627
+ write_log_comment(logging_enabled, logfile_file_name, _ev[1], tz_offset, now_str=_ev[0]) # time of the event, not of the write # shown in the report's comment timeline
2628
2628
  if down_streak is None:
2629
2629
  down_streak = {}
2630
2630
  # process in real chronological order (not the IP/hostname sort order the caller
@@ -2730,7 +2730,7 @@ def neutralize_csv_formula(text):
2730
2730
  return "'" + text
2731
2731
  return text
2732
2732
 
2733
- def write_log_comment(logging_enabled, logfile_file_name, comment_text, tz_offset=0):
2733
+ def write_log_comment(logging_enabled, logfile_file_name, comment_text, tz_offset=0, now_str=None):
2734
2734
  """Append a free-text, timestamped comment row to the CSV log (if logging is on).
2735
2735
 
2736
2736
  Uses the sentinel HOSTNAME '#COMMENT#' so epinga.py can split these rows out
@@ -2742,7 +2742,7 @@ def write_log_comment(logging_enabled, logfile_file_name, comment_text, tz_offse
2742
2742
  """
2743
2743
  if not logging_enabled or not comment_text:
2744
2744
  return False
2745
- now_str = get_date_time()
2745
+ now_str = now_str or get_date_time()
2746
2746
  ts = datetime.datetime.strptime(now_str, "%d/%m/%Y %H:%M:%S")
2747
2747
  if tz_offset:
2748
2748
  ts = ts + datetime.timedelta(hours=tz_offset)
@@ -7009,7 +7009,20 @@ class EpingWebServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
7009
7009
  pass
7010
7010
 
7011
7011
 
7012
+ def _port_in_use(bind_addr, port):
7013
+ """True if a listener already answers on the address we are about to bind. BSD/macOS lets a
7014
+ wildcard socket and a specific one share a port (SO_REUSEADDR), so bind() alone does not
7015
+ detect another instance bound to 127.0.0.1."""
7016
+ host = {'': '127.0.0.1', '0.0.0.0': '127.0.0.1', '::': '::1'}.get(bind_addr, bind_addr)
7017
+ try:
7018
+ with socket.create_connection((host, port), timeout=0.5):
7019
+ return True
7020
+ except OSError:
7021
+ return False
7022
+
7012
7023
  def start_web_server(bind_addr, port):
7024
+ if _port_in_use(bind_addr, port):
7025
+ error_handler('ERROR: unable to bind web gui to ' + str(bind_addr) + ':' + str(port) + ' - address already in use')
7013
7026
  try:
7014
7027
  httpd = EpingWebServer((bind_addr, port), EpingWebHandler)
7015
7028
  except OSError as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eping
3
- Version: 4.5
3
+ Version: 4.7
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.05
20
+ # eping.py 4.07
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.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes