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
a466af6a
Commit
a466af6a
authored
19 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Added check_hddtemp
parent
a51fcb3b
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_hddtemp
+66
-0
66 additions, 0 deletions
check_hddtemp
with
67 additions
and
1 deletion
Makefile
+
1
−
1
View file @
a466af6a
DESTDIR
=
/usr/local/nagios/libexec/
SCRIPTS
=
check_cups check_glsa check_saned check_lpd
SCRIPTS
=
check_cups check_glsa check_saned check_lpd
check_hddtemp
all
:
;
...
...
This diff is collapsed.
Click to expand it.
check_hddtemp
0 → 100755
+
66
−
0
View file @
a466af6a
#!/usr/bin/env python
#
# Check the hddtemp daemon on a remote host
#
# Usage: check_hddtemp host drive warn crit
#
# 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.
import
socket
import
sys
import
os
def
connect
(
host
):
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
try
:
s
.
connect
((
host
,
7634
))
except
socket
.
error
,
err
:
print
"
CRITICAL -
"
,
err
.
args
[
1
],
"
| queue=0
"
sys
.
exit
(
2
)
return
s
def
check_hddtemp
(
host
,
drive
,
warn
,
crit
):
s
=
connect
(
host
)
res
=
''
while
True
:
tmp
=
s
.
recv
(
65535
)
if
len
(
tmp
)
==
0
:
break
res
+=
tmp
s
.
close
()
for
drive_desc
in
res
.
split
(
'
||
'
):
drive_info
=
drive_desc
.
split
(
'
|
'
)
drv_name
=
drive_info
[
1
]
drv_type
=
drive_info
[
2
]
drv_temp
=
int
(
drive_info
[
3
])
drv_unit
=
drive_info
[
4
]
# C or F
if
drv_name
!=
drive
:
continue
if
drv_temp
>=
crit
:
print
"
CRITICAL -
"
,
drv_temp
,
"
C | temp=%d
"
%
drv_temp
sys
.
exit
(
2
)
elif
drv_temp
>=
warn
:
print
"
WARNING -
"
,
drv_temp
,
"
C | temp=%d
"
%
drv_temp
sys
.
exit
(
0
)
else
:
print
"
OK -
"
,
drv_temp
,
"
C | temp=%d
"
%
drv_temp
sys
.
exit
(
0
)
print
"
UNKNOWN -
"
,
drive
,
"
not found
"
sys
.
exit
(
3
)
def
usage
():
sys
.
stderr
.
write
(
"
usage: check_hddtemp host drive warn crit
\n
"
)
sys
.
exit
(
64
)
if
__name__
==
'
__main__
'
:
if
len
(
sys
.
argv
)
==
5
:
host
=
sys
.
argv
[
1
]
drive
=
sys
.
argv
[
2
]
warn
=
int
(
sys
.
argv
[
3
])
crit
=
int
(
sys
.
argv
[
4
])
else
:
usage
()
check_hddtemp
(
host
,
drive
,
warn
,
crit
)
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