Skip to content

Commit 79535ec

Browse files
committed
refactor(example): improve code
1 parent 3c4df02 commit 79535ec

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

check-plugins/example/example

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ except ImportError:
3131
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
3232
__version__ = '2025090701'
3333

34-
DESCRIPTION = """A working Linuxfabrik monitoring plugin, written in Python 3, as a basis for
35-
further development, and much more text to help admins get this check up and
36-
running."""
34+
DESCRIPTION = """
35+
A working Linuxfabrik monitoring plugin, written in Python 3, as a basis for
36+
further development, and much more text to help admins get this check up and
37+
running.
38+
"""
3739

3840
DEFAULT_WARN = 80
3941
DEFAULT_CRIT = 90
@@ -144,7 +146,15 @@ def main():
144146
# build the message
145147
state = lib.base.get_state(value, args.WARN, args.CRIT)
146148
msg += '{}% used{}'.format(value, lib.base.state2str(state, prefix=' '))
147-
perfdata += lib.base.get_perfdata('usage_percent', value, '%', args.WARN, args.CRIT, 0, 100)
149+
perfdata += lib.base.get_perfdata(
150+
'cpu-usage',
151+
cpu_usage,
152+
uom='%',
153+
warn=args.WARN,
154+
crit=args.CRIT,
155+
_min=0,
156+
_max=100,
157+
)
148158

149159
# over and out
150160
lib.base.oao(msg, state, perfdata, always_ok=args.ALWAYS_OK)

0 commit comments

Comments
 (0)