Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nagios-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lysator
nagios-plugins
Commits
c3cee871
Commit
c3cee871
authored
3 months ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Simplify check_lysrdiff
parent
1e6a0607
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_lysrdiff
+43
-41
43 additions, 41 deletions
check_lysrdiff
with
43 additions
and
41 deletions
check_lysrdiff
+
43
−
41
View file @
c3cee871
...
...
@@ -107,58 +107,60 @@ ACTIVITY=`wc -l < $state-active`
PERF
=
"activity=
$ACTIVITY
stale=
$STALE
failed=
$FAILED
"
if
[
$FAILED
-gt
10
]
then
echo
-n
"CRITICAL -
$FAILED
failed backups"
if
[
$STALE
-gt
0
]
then
echo
-n
" (also
$STALE
stale)"
fi
echo
-n
": "
sed
-n
's/--fail$//p'
$state
| list_jobs
echo
". |
$PERF
"
exit
2
fi
worst
=
0
state_word
=
OK
message
=
""
if
[
$STALE
-gt
10
]
then
echo
-n
"CRITICAL -
$STALE
stale backups"
if
[
$FAILED
-gt
0
]
then
echo
-n
" (also
$FAILED
failed)"
fi
(
sed
-n
's/--fail$//p'
$state
;
sed
's/--start$//'
$state
-stale
;
)
\
| list_jobs
echo
". |
$PERF
"
exit
2
fi
set_state
()
{
if
[
$1
-gt
$worst
]
then
worst
=
$1
state_word
=
$2
fi
if
[
-n
"
$3
"
]
then
if
[
-z
"
$message
"
]
then
message
=
"
$3
"
else
message
=
"
$message
$3
"
fi
fi
}
if
[
$FAILED
-gt
0
]
then
echo
-n
"WARNING -
$FAILED
failed backups"
if
[
$STALE
-gt
0
]
then
echo
-n
" (also
$STALE
stale)"
fi
echo
-n
": "
sed
-n
's/--fail$//p'
$state
| list_jobs
echo
". |
$PERF
"
exit
1
msg
=
"
$FAILED
failed backups:
`
sed
-n
's/--fail$//p'
$state
| list_jobs
`
."
if
[
$FAILED
-gt
10
]
then
set_state 2 CRITICAL
"
$msg
"
else
set_state 1 WARNING
"
$msg
"
fi
fi
if
[
$STALE
-gt
0
]
then
echo
-n
"WARNING -
$STALE
stale backups: "
sed
's/--start$//'
$state
-stale
| list_jobs
echo
". |
$PERF
"
exit
1
msg
=
"
$STALE
stale backups:
`
sed
's/--start$//'
$state
-stale
| list_jobs
`
."
if
[
$STALE
-gt
10
]
then
set_state 2 CRITICAL
"
$msg
"
else
set_state 1 WARNING
"
$msg
"
fi
fi
if
[
$ACTIVITY
=
0
]
then
echo
"WARNING - No activity. |
$PERF
"
exit
1
set_state 1 WARNING
"No activity."
fi
if
[
-z
"
$message
"
]
then
set_state 0 OK
"all ok."
fi
echo
"
OK - all ok.
|
$PERF
"
exit
0
echo
"
$state_word
-
$message
|
$PERF
"
exit
$worst
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