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
8d85172f
Commit
8d85172f
authored
18 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Added check_hydra
parent
1e8aa5aa
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+2
-1
2 additions, 1 deletion
Makefile
check_hydra
+68
-0
68 additions, 0 deletions
check_hydra
with
70 additions
and
1 deletion
Makefile
+
2
−
1
View file @
8d85172f
LIBEXECDIR
=
/usr/local/nagios/libexec/
LIBEXECDIR
=
/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_syslog
\
check_link_status check_true check_lysrdiff check_syslog
\
check_ping check_enodia_monitored check_hostextinfo
check_ping check_enodia_monitored check_hostextinfo
\
check_hydra
all
:
;
all
:
;
...
...
This diff is collapsed.
Click to expand it.
check_hydra
0 → 100755
+
68
−
0
View file @
8d85172f
#!/usr/bin/env python
import
sys
import
socket
import
pcl_expect
import
pcl_expect.telnet
def
debug
(
s
):
print
s
#pcl_expect.debug = debug
def
critical
(
msg
):
print
"
CRITICAL - %s
"
%
msg
sys
.
exit
(
2
)
def
warning
(
msg
):
print
"
WARNING - %s
"
%
msg
sys
.
exit
(
1
)
def
ok
(
msg
):
print
"
OK - %s
"
%
msg
sys
.
exit
(
0
)
def
check_hydra
(
hydra
,
hostname
):
try
:
t
=
pcl_expect
.
telnet
.
Telnet
(
hydra
,
'
telnet
'
)
except
socket
.
gaierror
,
err
:
critical
(
"
looking up %s: %s
"
%
(
hydra
,
err
[
1
]))
except
socket
.
error
,
err
:
critical
(
"
connecting to %s: %s
"
%
(
hydra
,
err
[
1
]))
t
.
send
(
hostname
+
'
\n
'
)
x
=
pcl_expect
.
Controller
()
while
x
.
loop
():
if
x
.
re
(
t
,
"
%s
\r
?
\n
"
%
hostname
):
break
elif
x
.
timeout
():
critical
(
"
no echo of hostname while talking to %s
"
%
hydra
)
x
=
pcl_expect
.
Controller
()
while
x
.
loop
():
if
x
.
re
(
t
,
"
Attached to port [0-9]*
\r
?
\n
"
):
break
elif
x
.
re
(
t
,
"
busy, do you wish to wait.*:
"
):
# FIXME: Only warn after an hour.
warning
(
"
port busy
"
)
elif
x
.
re
(
t
,
"
Rotaries Defined:
"
):
critical
(
"
unexpected output from hydra: %s
"
%
repr
(
t
.
consumed
))
elif
x
.
eof
(
t
):
critical
(
"
unexpected EOF from telnet
"
)
elif
x
.
timeout
():
critical
(
"
unexpected timeout while talking to the hydra
"
)
t
.
send
(
"
\025
"
)
# Ctrl-U.
t
.
send
(
"
\n
"
)
x
=
pcl_expect
.
Controller
()
while
x
.
loop
():
if
x
.
re
(
t
,
"
%s .*login:
"
%
hostname
):
ok
(
repr
(
t
.
consumed
.
strip
()))
elif
x
.
timeout
():
critical
(
"
timeout while waiting for login prompt
"
)
if
__name__
==
'
__main__
'
:
check_hydra
(
sys
.
argv
[
1
],
sys
.
argv
[
2
])
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