Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cscf
icinga-plugins
Commits
7e235948
Commit
7e235948
authored
2 years ago
by
root
Browse files
Options
Downloads
Patches
Plain Diff
Added check_uname.
parent
b403cdea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_uname
+49
-0
49 additions, 0 deletions
check_uname
with
49 additions
and
0 deletions
check_uname
0 → 100755
+
49
−
0
View file @
7e235948
#!/usr/bin/python3
# Author: Devon Merner (dmerner)
# Date: April 21, 2022
# Purpose: To parse uname
STATE_OK
=
0
STATE_WARNING
=
1
STATE_CRITICAL
=
2
STATE_UNKNOWN
=
3
STATE_LABEL
=
{
STATE_OK
:
"
OK
"
,
STATE_WARNING
:
"
WARNING
"
,
STATE_CRITICAL
:
"
CRITICAL
"
,
STATE_UNKNOWN
:
"
UNKNOWN
"
}
# Default exit code
EXIT_CODE
=
STATE_OK
import
sys
import
argparse
import
subprocess
import
json
import
shutil
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
-d
"
,
action
=
"
store_true
"
,
dest
=
"
debug
"
,
help
=
"
Print debug information
"
)
options
=
parser
.
parse_args
()
def
main
():
# mpstat -P ALL -o JSON
fsout
=
subprocess
.
Popen
([
'
uname
'
,
'
-a
'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
encoding
=
"
utf-8
"
)
stdout
=
fsout
.
stdout
.
read
().
rstrip
()
print
(
stdout
+
"
|
"
)
# Critical/Warning Think Logic
if
EXIT_CODE
==
STATE_CRITICAL
:
sys
.
exit
(
STATE_CRITICAL
)
elif
EXIT_CODE
==
STATE_WARNING
:
sys
.
exit
(
STATE_WARNING
)
else
:
sys
.
exit
(
STATE_OK
)
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment