From 0a6c581f651682572960a9c211412dd33ddbd986 Mon Sep 17 00:00:00 2001 From: Markus Frei Date: Sat, 30 Mar 2024 17:07:14 +0100 Subject: [PATCH] file-size: Improve defaults and output --- check-plugins/file-size/README.rst | 4 ++-- check-plugins/file-size/file-size | 8 ++++---- .../file-size/icingaweb2-module-director/file-size.json | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/check-plugins/file-size/README.rst b/check-plugins/file-size/README.rst index 5d5a337f..68e87873 100644 --- a/check-plugins/file-size/README.rst +++ b/check-plugins/file-size/README.rst @@ -39,7 +39,7 @@ Help --always-ok Always returns OK. -c CRIT, --critical CRIT Threshold for the file size in Bytes. Supports Nagios - ranges. Default: :1073741824 + ranges. Default: 1073741824 --filename FILENAME File (or directory) name to check. Supports glob in accordance with https://docs.python.org/2.7/library/glob.html. Note @@ -58,7 +58,7 @@ Help --username USERNAME SMB Username. -w WARN, --warning WARN Threshold for the file size in Bytes. Supports Nagios - ranges. Default: :26214400 + ranges. Default: 26214400 Usage Examples diff --git a/check-plugins/file-size/file-size b/check-plugins/file-size/file-size index bc2d87ea..f34f637b 100755 --- a/check-plugins/file-size/file-size +++ b/check-plugins/file-size/file-size @@ -37,10 +37,10 @@ __version__ = '2024033002' DESCRIPTION = 'Checks the size for a file (in bytes).' -DEFAULT_CRIT = ':{}'.format(str(1024*1024*1024)) # 1G (Gibibyte) +DEFAULT_CRIT = str(1024*1024*1024) # 1G (Gibibyte) DEFAULT_PATTERN = '*' DEFAULT_TIMEOUT = 3 -DEFAULT_WARN = ':{}'.format(str(25*1024*1024))# 25M (Mebibyte) +DEFAULT_WARN = str(25*1024*1024) # 25M (Mebibyte) def parse_args(): @@ -219,10 +219,10 @@ def main(): ) if len(table_data) == 1: # show info on first line when there is only one hit - msg += 'Checked {}, {}{}'.format( + msg += ' Checked {}: {} {}'.format( table_data[0]['filename'], table_data[0]['size_hr'], - table_data[0]['state_hr'], + lib.base.state2str(table_data[0]['state'], prefix=' '), ) else: msg += '\n\n' + lib.base.get_table( diff --git a/check-plugins/file-size/icingaweb2-module-director/file-size.json b/check-plugins/file-size/icingaweb2-module-director/file-size.json index a414316d..1512d272 100644 --- a/check-plugins/file-size/icingaweb2-module-director/file-size.json +++ b/check-plugins/file-size/icingaweb2-module-director/file-size.json @@ -149,10 +149,10 @@ "vars": { "criticality": "C", "file_size_always_ok": false, - "file_size_critical": ":1073741824", + "file_size_critical": "1073741824", "file_size_pattern": "*", "file_size_timeout": 3, - "file_size_warning": ":26214400" + "file_size_warning": "26214400" }, "volatile": null, "zone": null,