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
4eb51fad
Commit
4eb51fad
authored
18 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Check that Nagios monitors all hosts found by Enodia.
parent
fc93e91b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+2
-1
2 additions, 1 deletion
Makefile
check_enodia_monitored
+39
-0
39 additions, 0 deletions
check_enodia_monitored
check_ping
+18
-0
18 additions, 0 deletions
check_ping
with
59 additions
and
1 deletion
Makefile
+
2
−
1
View file @
4eb51fad
DESTDIR
=
/usr/local/nagios/libexec/
SCRIPTS
=
check_cups check_glsa check_saned check_lpd check_hddtemp
\
check_link_status check_true check_lysrdiff check_syslog
check_link_status check_true check_lysrdiff check_syslog
\
check_ping check_enodia_monitored
all
:
;
...
...
This diff is collapsed.
Click to expand it.
check_enodia_monitored
0 → 100755
+
39
−
0
View file @
4eb51fad
#!/bin/sh
# Check that all hosts in /opt/enodia/export/active_ips.txt are
# monitored by Nagios. More accurately, for each line in
# active_ips.txt, check that /usr/local/nagios/var/checked_ips/$ip
# exists and is at most 24 hours old. That file is created by the
# check_ping script.
CHECKED
=
/usr/local/nagios/var/checked_ips
UNCHECKED
=
`
tempfile
`
unmonitored
=
""
find
"
$CHECKED
"
-mtime
+1
-exec
rm
{}
\;
while
read
ip host
do
if
[
!
-f
$CHECKED
/
$ip
]
then
echo
"
$ip
(
$host
)"
>>
"
$UNCHECKED
"
fi
done
< /opt/enodia/export/active_ips.txt
unchecked
=
`
wc
-l
<
"
$UNCHECKED
"
`
if
[
$unchecked
=
0
]
then
echo
"OK - all checked | unchecked=0"
mv
-f
"
$UNCHECKED
"
/usr/local/nagios/var/unchecked
exit
0
else
echo
-n
"CRITICAL -
$unchecked
unchecked hosts: "
sed
's/\.lysator\.liu\.se)$/)/'
"
$UNCHECKED
"
\
|
awk
'BEGIN { sz = 0 }
NR > 1 && sz < 198 { printf ", "; sz += 2 }
sz < 200 { printf "%s", $0; sz += length($0) }
END { if (sz >= 200) printf ", others" } '
\
|
sed
's/, \([^,]*\)$/ and \1/'
echo
". | unchecked=
$unchecked
"
mv
-f
"
$UNCHECKED
"
/usr/local/nagios/var/unchecked
exit
2
fi
This diff is collapsed.
Click to expand it.
check_ping
0 → 100755
+
18
−
0
View file @
4eb51fad
#!/bin/sh
[
"
$1
"
=
"-H"
]
||
fatal
HOSTADDRESS
=
"
$2
"
[
"
$3
"
=
"-w"
]
||
fatal
WARN
=
"
$4
"
[
"
$5
"
=
"-c"
]
||
fatal
CRIT
=
"
$6
"
[
"
$7
"
=
"-p"
]
||
fatal
P
=
"
$8
"
IP_TMP
=
`
tempfile
`
if
getent hosts
$HOSTADDRESS
>
"
$IP_TMP
"
then
read
ip host <
"
$IP_TMP
"
touch
/usr/local/nagios/var/checked_ips/
$ip
fi
rm
-f
"
$IP_TMP
"
exec
/usr/nagios/libexec/check_ping
-H
"
$HOSTADDRESS
"
-w
"
$WARN
"
-c
"
$CRIT
"
-p
"
$P
"
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