Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
99f4d4be
Commit
99f4d4be
authored
4 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
remove foreign check for cpu
parent
5a500d6b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
check-cpu.sh
+0
-84
0 additions, 84 deletions
check-cpu.sh
with
1 addition
and
84 deletions
.gitignore
+
1
−
0
View file @
99f4d4be
...
@@ -2,3 +2,4 @@ check_smart.pl
...
@@ -2,3 +2,4 @@ check_smart.pl
paramtest
paramtest
check_snmp_syno.sh
check_snmp_syno.sh
check_snmp_synology
check_snmp_synology
check-cpu.sh
\ No newline at end of file
This diff is collapsed.
Click to expand it.
check-cpu.sh
deleted
100755 → 0
+
0
−
84
View file @
5a500d6b
#!/bin/bash
#
# Check CPU usage
#
# ===
#
# Examples:
#
# check-cpu.sh -w 85 -c 95
#
# Date: 2014-09-12
# Author: Jun Ichikawa <jun1ka0@gmail.com>
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
# get arguments
while
getopts
':w:c:h'
OPT
;
do
case
$OPT
in
w
)
WARN
=
$OPTARG
;;
c
)
CRIT
=
$OPTARG
;;
h
)
hlp
=
"yes"
;;
*
)
unknown
=
"yes"
;;
esac
done
PROC_PATH
=
${
PROC_PATH
:-
'/proc'
}
# usage
HELP
=
"
usage:
$0
[ -w value -c value -p -h ]
-w --> Warning percentage < value
-c --> Critical percentage < value
-h --> print this help screen
"
if
[
"
$hlp
"
=
"yes"
]
;
then
echo
"
$HELP
"
exit
0
fi
cpuusage1
=(
`
cat
/proc/stat |
head
-1
`
)
if
[
${#
cpuusage1
}
-eq
0
]
;
then
echo
"CRITICAL - CPU UNKNOWN"
exit
2
fi
sleep
1
cpuusage2
=(
`
cat
$PROC_PATH
/stat |
head
-1
`
)
if
[
${#
cpuusage2
}
-eq
0
]
;
then
echo
"CRITICAL - CPU UNKNOWN"
exit
2
fi
WARN
=
${
WARN
:
=90
}
CRIT
=
${
CRIT
:
=95
}
cpu_diff
=(
0
)
total
=
0
usage_diff
=
0
for
i
in
`
seq
1 9
`
do
cpu_diff
=(
"
${
cpu_diff
[@]
}
"
`
echo
"
${
cpuusage2
[
$i
]
}
-
${
cpuusage1
[
$i
]
}
"
| bc
`
)
total
=
`
echo
"
$total
+
${
cpu_diff
[
$i
]
}
"
| bc
`
if
[
$i
-ne
"4"
]
;
then
usage_diff
=
`
echo
"
$usage_diff
+
${
cpu_diff
[
$i
]
}
"
| bc
`
else
idl
=
$cpu_diff
[
$i
]
fi
done
cpu_usage
=
`
echo
"scale=2; 100*
$usage_diff
/
$total
"
| bc
`
if
[
"
$(
echo
"
${
cpu_usage
}
>
${
CRIT
}
"
| bc
)
"
-eq
1
]
;
then
echo
"CPU CRITICAL -
${
cpu_usage
}
% is greater than critical point.[
${
CRIT
}
]"
exit
2
fi
if
[
"
$(
echo
"
${
cpu_usage
}
>
${
WARN
}
"
| bc
)
"
-eq
1
]
;
then
echo
"CPU WARNING -
${
cpu_usage
}
% is greater than warning point.[
${
WARN
}
]"
exit
1
fi
echo
"CPU OK - Usage:
${
cpu_usage
}
"
exit
0
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