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
1e6a0607
"src/server/isc-malloc.c" did not exist on "c2bedd424939fa3266ee9c8338d75ebc8e2db118"
Commit
1e6a0607
authored
4 months ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring: extract list_jobs
parent
6ded6169
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_lysrdiff
+16
-23
16 additions, 23 deletions
check_lysrdiff
with
16 additions
and
23 deletions
check_lysrdiff
+
16
−
23
View file @
1e6a0607
...
...
@@ -42,6 +42,18 @@ disk=$1
part
=
$2
BASE
=
/lysrdiff/
$disk
/perm/
$part
# Emit a list of the first few backup jobs. Keep the output small, by
# ending it with "and others" if it becomes too long. ~200 characters
# are OK.
list_jobs
()
{
awk
'BEGIN { sz = 0 }
NR > 1 && sz < 198 { printf ", "; sz += 2 }
sz < 200 { printf "%s", $3; sz += length($3) }
END { if (sz >= 200) printf ", others" } '
\
|
sed
s
'/, \([^,]*\)$/ and \1/'
}
if
[
!
-f
$BASE
/lysrdiff.id
]
then
echo
CRITICAL -
$BASE
/lysrdiff.id: no such file
...
...
@@ -103,12 +115,7 @@ then
echo
-n
" (also
$STALE
stale)"
fi
echo
-n
": "
sed
-n
's/--fail$//p'
$state
\
|awk
'BEGIN { sz = 0 }
NR > 1 && sz < 198 { printf ", "; sz += 2 }
sz < 200 { printf "%s", $3; sz += length($3) }
END { if (sz >= 200) printf ", others" } '
\
|sed s
'/, \([^,]*\)$/ and \1/'
sed
-n
's/--fail$//p'
$state
| list_jobs
echo
". |
$PERF
"
exit
2
fi
...
...
@@ -121,11 +128,7 @@ then
echo
-n
" (also
$FAILED
failed)"
fi
(
sed
-n
's/--fail$//p'
$state
;
sed
's/--start$//'
$state
-stale
;
)
\
|awk
'BEGIN { sz = 0 }
NR > 1 && sz < 198 { printf ", "; sz += 2 }
sz < 200 { printf "%s", $3; sz += length($3) }
END { if (sz >= 200) printf ", others" } '
\
|sed s
'/, \([^,]*\)$/ and \1/'
| list_jobs
echo
". |
$PERF
"
exit
2
fi
...
...
@@ -138,12 +141,7 @@ then
echo
-n
" (also
$STALE
stale)"
fi
echo
-n
": "
sed
-n
's/--fail$//p'
$state
\
|awk
'BEGIN { sz = 0 }
NR > 1 && sz < 198 { printf ", "; sz += 2 }
sz < 200 { printf "%s", $3; sz += length($3) }
END { if (sz >= 200) printf ", others" } '
\
|sed s
'/, \([^,]*\)$/ and \1/'
sed
-n
's/--fail$//p'
$state
| list_jobs
echo
". |
$PERF
"
exit
1
fi
...
...
@@ -151,12 +149,7 @@ fi
if
[
$STALE
-gt
0
]
then
echo
-n
"WARNING -
$STALE
stale backups: "
sed
's/--start$//'
$state
-stale
\
|awk
'BEGIN { sz = 0 }
NR > 1 && sz < 198 { printf ", "; sz += 2 }
sz < 200 { printf "%s", $3; sz += length($3) }
END { if (sz >= 200) printf ", others" } '
\
|sed s
'/, \([^,]*\)$/ and \1/'
sed
's/--start$//'
$state
-stale
| list_jobs
echo
". |
$PERF
"
exit
1
fi
...
...
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