Skip to content

Commit

Permalink
file-size: Improve defaults and output
Browse files Browse the repository at this point in the history
  • Loading branch information
markuslf committed Mar 30, 2024
1 parent 37fc32b commit 0a6c581
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions check-plugins/file-size/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions check-plugins/file-size/file-size
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0a6c581

Please sign in to comment.