Package: chksrv
check-service a tool to probe and check the health of network serviceschksrvis a tool intended to be used in conjunction with other tools (e.g.Minitor)
to check the health and availability of network services.
One design goal was to provide flexibility of what is checked,
without the need for complex bash scripts and piping. Effectively allowing to
write one check and then validating mulitple measurements afterwards.Installationpip install chksrvYou need at least Python 3.7 to runchksrv.UsageUsage:
    chksrv (-h | --help)
    chksrv --version
    chksrv tcp [options] [-p PARAM=VALUE]... [-e EXPR]... HOST PORT
    chksrv ssl [options] [-p PARAM=VALUE]... [-e EXPR]... HOST PORT
    chksrv http [options] [-p PARAM=VALUE]... [-e EXPR]... URL

Options:
    -h --help                     Show this screen.
    --version                     Show version.
    -v --verbose                  Increases verbosity.
    -l --log-level LEVEL          Defines the log verbosity [default: WARN].
    --log-file FILE               Stores all log output in a file.
    -p --parameter PARAM=VALUE    Defines a parameter.
    -e --expects EXPR             Defines an expection expression.
    -r --retry RETRY              Defines the amount of retries [default: 3].
    --timeout TIMEOUT             Defines a timeout for one try in seconds [default: 10].ModulesTCPThe TCP is one of the most basic check modules.
Its purpose is to try to establish a connection
to a standard TCP listening socket.Parametersipv6:Specifies the IPv6 behaviour. Possible values:Trueonly tries to connect to IPv6Falseonly tries to connect to IPv4'prefer'tries to connect using IPv6 first,
and tries IPv4 if this fails (default)'fallback'tries to connect using IPv4 first,
and falls back to IPv6 if this failstimeout:Specifies the socket timeout in secondsResultstcp.success:Trueif the socket connect succededtcp.con.time.perf:Fractions of seconds it took to establish
the socket connectiontcp.con.time.process:Fractions of seconds of CPU time (system and user)
the process used to  establish the socket connectiontcp.ipv6:Trueif the socket was established using IPv6SSLThe SSL module is based on the TCP module <module-tcp> and layers
a SSL/TLS handshake on top of it, using the Python3ssllibrary.All parameters and results from the TCP module are available in additionParametersssl.use_default_context:If set toTruethe SSL context is created using systems defaults.ssl.protocolandssl.cipherswill be ignored.
(default:'prefer')ssl.check_hostname:If set toTruechksrv verifies if the SSL certificate commonName
matches the connected hostname. (default:False)ssl.protocol:SSL protocol to use. Possible values:tls(default)sslv2sslv3tlsv1tlsv1.1tlsv1.2ssl.ciphers:The cipher suite to use.
Must be a valid OpenSSL cipher suite string. (default:ALL)ssl.verify_mode:SSL verify mode. cf.ssl.VerifyMode(default:CERT_OPTIONAL)ssl.verify_flags:SSL verify flags. cf.ssl.VerifyFlags(default:VERIFY_DEFAULT)ssl.ca:Directory or file containing x509 certifcates of
trusted Certificate Authorities. By setting it to__sys__chksrtries to load the system default trusted certificates.Resultsssl.success:Trueif the SSL handshake was successfulssl.con.cert:Parsed x509 certificate the server used to authenticate itselfssl.con.cipher:Negotiated cipher used to this connectionssl.con.compression:Compression algorithm for this connection orNonessl.con.alpn_protocol:ALPN protocol selected during the TLS handshake
orNonessl.con.npn_protocol:NPN protocol selected during the SSL/TLS handshake
orNonessl.con.ssl_version:Actual SSL protocol version negotiated for this connection
orNoneif no secure connection was establishedssl.con.server_hostname:Hostname of the serverssl.con.cert.matches_hostname:Trueif the server hostname matches the
certificate commonNameHTTPThe HTTP module is intended to be used to check web services,
and relies on either the TCP or SSL module to establish
the underlying socket connection. Depending if the URL is
specified withhttp://orhttps://.Consequentlyall parameters from either only the TCP module or both
the TCP and SSL module are available in additionParametershttp.method:HTTP method of the request. Possible values:GET(default)HEADPOSTPUTDELETEOPTIONSPATCHTRACEhttp.body:Body to attach to the request. (default:None)Resultshttp.success:Trueif the HTTP request was successful.
(Does not evaluate the returned status code)http.resp.status:HTTP response status code (numeric)http.resp.reason:HTTP response reason (e.g.Found)http.resp.version:HTTP versionhttp.resp.body:HTTP response bodyhttp.resp.body_length:Actual size of the HTTP response body.
(Does not readContent-Lengthheader)http.resp.header.*:Collection of response headers, converted to lower-case snake_case.
So the header fieldContent-Lengthis available ashttp.resp.header.content_length. If a header field appears multiple
times in the response header (e.g.Set-Cookie) the value
is provided as list.