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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lysator
nagios-plugins
Commits
14217f99
Commit
14217f99
authored
18 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Added check_lysrdiff script.
parent
bfd32350
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
Makefile
+1
-1
1 addition, 1 deletion
Makefile
check_lysrdiff
+116
-0
116 additions, 0 deletions
check_lysrdiff
with
117 additions
and
1 deletion
Makefile
+
1
−
1
View file @
14217f99
DESTDIR
=
/usr/local/nagios/libexec/
DESTDIR
=
/usr/local/nagios/libexec/
SCRIPTS
=
check_cups check_glsa check_saned check_lpd check_hddtemp
\
SCRIPTS
=
check_cups check_glsa check_saned check_lpd check_hddtemp
\
check_link_status check_true
check_link_status check_true
check_lysrdiff
all
:
;
all
:
;
...
...
This diff is collapsed.
Click to expand it.
check_lysrdiff
0 → 100755
+
116
−
0
View file @
14217f99
#!/bin/sh
#
# This check script is maintained in a Subversion repository at
# http://lsvn.lysator.liu.se/svnroot/nagios-plugins. Contact
# <ceder@lysator.liu.se> for commit access.
activity
=
16
stale
=
36
usage
()
{
echo
$0
: usage:
$0
'[ opt ] partno'
>
&2
echo
options:
>
&2
echo
' --activty N Warn if no backup completed in the last N hours.'
>
&2
echo
' --stale N Critical if oldest backup is more than N hours old.'
>
&2
exit
3
}
while
[
$#
-gt
1
]
do
case
"x
$1
"
in
x--activity
)
activity
=
$2
shift
shift
;;
x--stale
)
stale
=
$2
shift
shift
;;
x--
*
)
usage
exit
1
;;
x
*
)
break
;;
esac
done
if
[
$#
!=
1
]
then
usage
fi
partno
=
$1
BASE
=
/lysrdiff/
$partno
/perm
if
[
!
-f
$BASE
/lysrdiff.id
]
then
echo
CRITICAL -
$BASE
: no such file
exit
2
fi
if
[
"
`
cat
$BASE
/lysrdiff.id
`
"
!=
"
$partno
perm"
]
then
echo
CRITICAL - found
`
cat
$BASE
/lysrdiff.id
`
instead of
$lysrdiff
>
&2
exit
2
fi
acttime
=
`
date
'+%Y-%m-%d %H:%M:%S'
-d
"
$activity
hours ago"
`
staletime
=
`
date
'+%Y-%m-%d %H:%M:%S'
-d
"
$stale
hours ago"
`
statecache
=
/tmp/lysrdiff-nagios-state
state
=
$statecache
-
$partno
find
$BASE
/lysrdiff/state
-type
f
\
-printf
"%TY-%Tm-%Td %TH:%TM:%TS %P
\n
"
\
|
sort
>
$statecache
.
$partno
.
$$
mv
-f
$statecache
.
$partno
.
$$
$state
echo
$staletime
MARKER
\
|
sort
$state
-
\
|
grep
--
'-start$\|MARKER'
\
|
sed
-e
'/MARKER$/,$d'
\
>
$state
-stale
echo
$acttime
MARKER
\
|
sort
$state
-
\
|
grep
--
'-end$\|MARKER'
\
|
sed
-e
'1,/MARKER$/d'
\
>
$state
-active
STALE
=
`
wc
-l
<
$state
-stale
`
ACTIVITY
=
`
wc
-l
<
$state
-active
`
if
grep
-q
--
'-fail$'
$state
then
echo
-n
"CRITICAL - Failed backups: "
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/'
echo
'. | activity='
$ACTIVITY
stale
=
$STALE
failed
=
`
grep
-c
--
'-fail$'
$state
`
exit
2
fi
if
[
$STALE
-gt
0
]
then
echo
-n
"CRITICAL - 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/'
echo
'. | activity='
$ACTIVITY
stale
=
$STALE
failed
=
0
exit
2
fi
if
[
$ACTIVITY
=
0
]
then
echo
-n
'WARNING - No activity. | activity='
0
stale
=
$STALE
failed
=
0
exit
1
fi
echo
'OK - all ok. | activity='
$ACTIVITY
stale
=
0
failed
=
0
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