Verified Commit d80ace33 authored by Jenny's avatar Jenny
Browse files

add compatibility for python > 3.7 for check_net_traffic

parent ba383ecf
......@@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- *ssl-cert-check* --> *check_ssl_cert*
- *check_hddtemp.sh* --> *check_hddtemp*
### Updated
- *check_net_traffic* - Added compatibility for Python > 3.7
## [1.1.0] - 2019-10-19
### Added
- *check_xen_cpu* - Reports CPU usage perfdata for all Xen Domains.
......
#!/usr/bin/env python3
# check_net_traffic
# Reports Network Traffic for all interfaces
# Author: Anton Schubert <ischluff@mailbox.org>
# Version: 1.0
# Authors: Anton Schubert <ischluff@mailbox.org>, Jennifer Graul <me@netali.de>
# Version: 1.1
# Changelog:
# 2018-06-05 - 1.0 - Initial version
# 2021-08-17 - 1.1 - Fix for Python > 3.7 compatibility
#
# Copyright (c) 2019
# Copyright (c) 2019-2021
# License: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
......@@ -31,9 +32,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from __future__ import print_function
import os, sys, time, argparse, math, json
import re
import errno
from enum import IntEnum
class Status(IntEnum):
......@@ -104,7 +105,7 @@ def main():
previous_sample = json.load(f)
except (IOError,OSError) as e:
if e.errno == os.errno.ENOENT:
if e.errno == errno.ENOENT:
status, message = Status.UNKNOWN, "History file not written yet"
else:
status, message = Status.UNKNOWN, "Failed to read the history file - {:}".format(e.strerror)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment