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
e9e1b3e9
Commit
e9e1b3e9
authored
18 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Added check_syslog, which checks that all hosts logs to syslog.
parent
b0064fce
Branches
Branches containing commit
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_syslog
+50
-0
50 additions, 0 deletions
check_syslog
with
51 additions
and
1 deletion
Makefile
+
1
−
1
View file @
e9e1b3e9
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_lysrdiff
check_link_status check_true check_lysrdiff
check_syslog
all
:
;
all
:
;
...
...
This diff is collapsed.
Click to expand it.
check_syslog
0 → 100755
+
50
−
0
View file @
e9e1b3e9
#!/usr/bin/env python
# Check that the syslog file for a certain host has changed recently.
# This script assumes that syslog log files are created using the
# following hierarchy:
#
# /misc/syslogs/2006-12/2006-12-18/sellafield
#
# where 2006 is a year, 12 a month, 18 a day, and sellafield a hostname.
import
time
import
os
import
errno
def
filename
(
y
,
m
,
d
,
host
):
return
"
/misc/syslogs/%04d-%02d/%04d-%02d-%02d/%s
"
%
(
y
,
m
,
y
,
m
,
d
,
host
)
def
find_newest_file
(
hostname
):
t
=
time
.
time
()
for
attempts
in
range
(
14
):
tm
=
time
.
localtime
(
t
)
fn
=
filename
(
tm
.
tm_year
,
tm
.
tm_mon
,
tm
.
tm_mday
,
hostname
)
try
:
statval
=
os
.
stat
(
fn
)
except
OSError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
else
:
return
fn
,
statval
t
-=
24
*
3600
return
None
,
None
def
check_host
(
hostname
):
fn
,
statval
=
find_newest_file
(
hostname
)
if
fn
is
None
:
print
"
CRITICAL - no activity within the last 14 days
"
sys
.
exit
(
2
)
age
=
time
.
time
()
-
statval
.
st_mtime
if
age
>
10
*
3600
:
print
"
WARNING - no activity for %.1g hours
"
%
(
age
/
3600.0
)
sys
.
exit
(
1
)
else
:
print
"
OK - activity %.2g hours ago
"
%
(
age
/
3600.0
)
if
__name__
==
'
__main__
'
:
import
sys
check_host
(
sys
.
argv
[
1
])
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