Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resmon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
mirrors
resmon
Commits
3c9108e9
Commit
3c9108e9
authored
14 years ago
by
Bryan Horstmann-Allen
Browse files
Options
Downloads
Patches
Plain Diff
add -e for numeric checks against resmon with Nagios
parent
adcca66a
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
resources/check_resmon_metric
+20
-4
20 additions, 4 deletions
resources/check_resmon_metric
with
20 additions
and
4 deletions
resources/check_resmon_metric
+
20
−
4
View file @
3c9108e9
...
...
@@ -178,7 +178,7 @@ use utils qw($TIMEOUT %ERRORS &print_revision &support);
delete
@ENV
{'
PATH
',
'
IFS
',
'
CDPATH
',
'
ENV
',
'
BASH_ENV
'};
my
(
$port
,
$host
,
$module
,
$check
,
$age
,
$warning
,
$critical
,
$regex
,
my
(
$port
,
$host
,
$module
,
$check
,
$age
,
$warning
,
$critical
,
$equals
,
$regex
,
$metric
,
$url
)
=
(
81
,"","","",
0
,
"",
"",
"",
"");
sub
help
{
...
...
@@ -192,8 +192,8 @@ sub help {
print
"
-m | --metric metric name to check
\n
";
print
"
-w | --warning warning threshold (numeric metrics only)
\n
";
print
"
-c | --critical critical threshold (numeric metrics only)
\n
";
print
"
-
r
| --
regex
regex match against the
me
t
ric
(string
";
print
"
metrics only)
\n
";
print
"
-
e
| --
equals
metric must equal this value (nu
meric
al metrics only)
\n
";
print
"
-r | --regex regex match against the metric (string print
metrics only)
\n
";
print
"
-u | --url specify an alternate URL to fetch
\n
";
exit
$ERRORS
{'
UNKNOWN
'};
}
...
...
@@ -279,6 +279,7 @@ GetOptions (
"
m|metric=s
"
=>
\
$metric
,
"
w|warning=s
"
=>
\
$warning
,
"
c|critical=s
"
=>
\
$critical
,
"
e|equals=i
"
=>
\
$equals
,
"
r|regex=s
"
=>
\
$regex
,
"
u|url=s
"
=>
\
$url
);
...
...
@@ -286,11 +287,16 @@ unless ($host && $module && $check) {
short_help
();
}
if
((
$warning
||
$critical
)
&&
$regex
)
{
if
((
$warning
||
$critical
||
$equals
)
&&
$regex
)
{
print
"
Cannot specify both numeric thresholds and a string based match
\n
";
exit
$ERRORS
{'
UNKNOWN
'};
}
if
((
$warning
||
$critical
)
&&
$equals
)
{
print
"
Cannot specify thresholds and equals
\n
";
exit
$ERRORS
{'
UNKNOWN
'};
}
my
$ua
=
LWP::
UserAgent
->
new
;
$url
=
"
/
$module
/
$check
"
unless
$url
;
my
$t
=
HTTP::
Request
->
new
('
GET
',
"
http://
$host
:
$port$url
");
...
...
@@ -325,6 +331,16 @@ eval {
die
"
Numeric threshold specified for a non-numeric metric
"
if
((
$warning
||
$critical
)
&&
$type
!~
/[0IlLni]/
);
if
(
$equals
)
{
if
(
$value
eq
$equals
)
{
$state
=
"
OK
";
}
else
{
$state
=
"
CRITICAL
";
}
print
"
$state
:
$value
\n
";
}
if
(
$regex
)
{
if
(
$value
=~
/$regex/
)
{
$state
=
"
OK
";
...
...
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