Commit Graph

83 Commits

Author SHA1 Message Date
Markus Opolka
5c4a955abd Fix object comparision 2024-06-28 14:40:19 +02:00
aro-lew
b920a65afd
Feature: Add Timestamp checks (#87) 2024-06-28 14:39:57 +02:00
Markus Opolka
27936784c4 Bump release to v2.2.0 2024-05-14 17:01:53 +02:00
Markus Opolka
0aceabfe91 Add verbose flag and function that can be used to enhance output more precisely
- Before we only had a boolean debug flag, good for debugging errors.
   The verbose flag can be used more precisely (`-v -vvv`) to specify when
   something should be printed. This is useful for adding more output whilst avoiding
   full debug output that contains secrets.
2024-04-09 14:08:02 +02:00
Markus Opolka
4fbb0c828a Add flag to override URL unreachable state
- I refactored the Nagios helper a bit to integrate this functionality a bit simpler.
   Before we had distinct methods on the helper that added warn,crit,unko message, now
   there's a general method that takes an int as parameter.
   This way we avoid if-else structures for the new functionality.
2024-04-09 14:07:45 +02:00
Markus Opolka
e96bba0eb8 Refactor for a leaner main function
- Also added tests for TLS options
2024-04-09 14:07:36 +02:00
Markus Hof
739c093702 disabled check_hostname to prevent error message when setting CERT_NONE 2022-10-04 16:04:12 +02:00
Markus Opolka
46271c961b Bump version to 2.1.2 2022-09-15 15:25:38 +02:00
Markus Opolka
9f41fc491e Add CLI flag to change HTTP method 2022-09-09 17:28:35 +02:00
Markus Opolka
3a22b712ab Fix deprecation of PROTOCOL_TLS 2022-09-09 17:26:23 +02:00
Markus Opolka
c54a0040a0 Update pylint config 2022-09-08 10:08:39 +02:00
K0nne
428a5a6d3a
fix missing type conversion for --data
The parameter --data is handled as type string, but the method urlopen() only accepts the datatype byte.
Before this fix you will get: "TypeError: POST data should be  bytes, an iterable of bytes, or a filer object. It cannot be of type str."
This PR solves this.
2022-07-27 13:30:25 +02:00
Rémi Ferrand
63542f3226 If TLS is enabled, context now loads the system default C.A files
* This allows system wide deployed C.A to be used without any further
  configuration.
2021-01-21 12:02:41 +01:00
Markus Opolka
1f440e0ff5 Fix conditional check on empty data.
Fixes issue #64
2020-07-15 08:07:16 +02:00
Markus Opolka
47a37556ba
Merge branch 'v2-1' into key-equals-empty 2020-07-03 09:03:21 +02:00
Markus Opolka
f7c0472cdc Add JSON parsing on HTTPError
- Only if response contains JSON
2020-07-02 11:35:23 +02:00
Markus Opolka
25fb340bbb Add handling of empty JSON return values
- Will now throw a CRITICAL
2020-06-26 10:39:37 +02:00
Markus Opolka
47bdea7fc5 Add spaces to debug output 2020-06-26 10:31:20 +02:00
Markus Opolka
866a12ea07 Add JSON parsing on HTTPError
- Only if response contains JSON
2020-06-19 14:26:59 +02:00
Markus Opolka
941afeed89 Move main entrypoint to own function for simpler testing 2020-06-19 13:12:51 +02:00
Markus Opolka
dd952fd571 Replace deprecated encodestring
- Fixes #56
2020-03-18 08:47:27 +01:00
Markus Opolka
83ee5062f5 [wip] Add pylint and fix pylint issues 2020-03-18 08:18:07 +01:00
Markus Opolka
c90b0323f5 Show returned JSON in OK Status when performance data is requested 2020-03-18 07:41:23 +01:00
Markus Opolka
2c98e840e8 Extend unittest coverage 2020-03-18 07:41:18 +01:00
Martin Liska
404890d918
Fix new Python3.8 warnings:
./check_http_json.py:186: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if elemData is (None, 'not_found'):
./check_http_json.py:189: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if subElemKey is not '':
2020-03-12 09:37:53 +01:00
Markus Opolka
71cbd98e79 Add value_separator option to specify how JSON values are being split
- Fixes issue 43
2020-03-08 11:28:27 +01:00
Markus Opolka
e4801227bf Add boundary check for SubArrayElement function
- Fixes Issue 34
2020-03-05 10:05:32 +01:00
Markus Opolka
b7c0b0595e Add unittest for argsparse 2020-03-03 12:12:52 +01:00
Markus Opolka
95912246a2 Add and format some doc_strings 2020-03-03 11:44:55 +01:00
Markus Opolka
174686a980 Move test to separat file 2020-03-03 09:48:10 +01:00
Martin Liska
2289fb2af3
Port to Python3 (#48).
I used 2to3 script and then I clean up result of the conversion.
2020-01-28 12:13:30 +01:00
Markus Opolka
209aaef041 Fix inconsistent use of tabs/spaces 2020-01-28 10:42:22 +01:00
Markus Opolka
65c3bd2a25 Set default context variable to -k --insecure option 2020-01-28 10:41:29 +01:00
Markus Opolka
9c0c59d6c1 Fix unittests 2020-01-28 10:22:05 +01:00
Ricardo Bartels
47547951cf fixed minor bugs and added compatibility for RHEL/CentOS 7.x
* change ssl.PROTOCOL_TLS to ssl.PROTOCOL_SSLv23
* fixed bug that response var not passed outside try/except block
* fixed arrer in nagios.append_metrics()
2019-05-09 16:39:41 +02:00
Ricardo Bartels
7858382bbe Added default User-Agent header
* prevent errors for services which require this header (like Cloudflare WAF)
2019-05-09 15:53:59 +02:00
Ricardo Bartels
bcc36a6e95 added version information and improved help text 2019-05-09 15:44:33 +02:00
Ricardo Bartels
d98d0396b2 return more meaningful error message if parsing of data failed 2019-05-09 15:06:52 +02:00
Ricardo Bartels
8437c464e5 refine ssl insecure and client certificate options
* default TLS Protocols are now set to >= TLS1
* --cacert and --cert are no longer mandatory if option -s is used
* proper error messages if parsing of cert or key files fails
2019-05-09 14:55:25 +02:00
Ricardo Bartels
df2bbdbf51 Merge remote-tracking branch 'theicfire/master' into next-release 2019-05-09 13:38:37 +02:00
Ricardo Bartels
823fc275c9 fixed expansion on newly merged command line args 2019-05-09 13:18:34 +02:00
Ricardo Bartels
18b0898e72 Merge remote-tracking branch 'nrobert13/tg' into next-release 2019-05-09 12:39:58 +02:00
Ricardo Bartels
95318954bf fixed indentation and and print statements
* clean up from previous merges
2019-05-09 11:58:50 +02:00
Ricardo Bartels
8e469e3d98 Merge branch 'luban8' into next-release 2019-05-09 11:30:26 +02:00
Ricardo Bartels
29f8d892ee Merge branch 'ack-expand-array' into next-release 2019-05-09 11:17:51 +02:00
Martin Sura
81522fa9ab
fix intedation 2019-05-07 16:23:48 +02:00
Martin Sura
27eaaf0842 Add unknown option 2019-05-07 16:15:31 +02:00
Chase Lambert
9dd6323b85 Better failure message for exact keys 2018-04-02 09:34:00 -04:00
Robert Nemeti
67136a4a2b add client ssl cert support 2018-02-15 17:04:04 +01:00
Robert Nemeti
d164a1250c add key,value non equality check, the opposite of the -q and -Q 2018-01-10 10:23:34 +01:00