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
f68a864a
Commit
f68a864a
authored
19 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Added check_lpd
parent
a2fead09
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_lpd
+63
-0
63 additions, 0 deletions
check_lpd
with
64 additions
and
1 deletion
Makefile
+
1
−
1
View file @
f68a864a
DESTDIR
=
/usr/local/nagios/libexec/
DESTDIR
=
/usr/local/nagios/libexec/
SCRIPTS
=
check_cups check_glsa check_saned
SCRIPTS
=
check_cups check_glsa check_saned
check_lpd
all
:
;
all
:
;
...
...
This diff is collapsed.
Click to expand it.
check_lpd
0 → 100755
+
63
−
0
View file @
f68a864a
#!/usr/bin/env python
#
# Check an lpd queue on a remote host
#
# Usage: check_lpd host queue
#
# 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
,
515
))
except
socket
.
error
,
err
:
print
"
CRITICAL -
"
,
err
.
args
[
1
],
"
| queue=0
"
sys
.
exit
(
2
)
return
s
def
check_queue
(
host
,
queue
):
s
=
connect
(
host
)
s
.
send
(
'
%c%s
\n
'
%
(
4
,
queue
))
res
=
s
.
recv
(
65535
)
s
.
close
()
if
host
==
'
laser
'
:
if
res
==
'
JetDirect lpd: no jobs queued on this port
\r\n
'
:
print
"
OK - queue empty. | queue=0
"
sys
.
exit
(
0
)
elif
res
==
'
Active connection from 192.168.10.100
\r\n
'
:
print
"
WARNING - somebody is printing | queue=1
"
sys
.
exit
(
1
)
else
:
print
"
UNKNOWN -
"
,
repr
(
res
),
"
| queue=0
"
sys
.
exit
(
3
)
elif
host
==
'
copier
'
:
if
res
==
'
no entries
\n
'
:
print
"
OK - queue empty. | queue=0
"
sys
.
exit
(
0
)
else
:
print
"
UNKNOWN -
"
,
repr
(
res
),
"
| queue=0
"
sys
.
exit
(
3
)
print
res
def
usage
():
sys
.
stderr
.
write
(
"
usage: check_lpd host [queue]
\n
"
)
sys
.
exit
(
64
)
if
__name__
==
'
__main__
'
:
if
len
(
sys
.
argv
)
==
3
:
host
=
sys
.
argv
[
1
]
queue
=
sys
.
argv
[
2
]
elif
len
(
sys
.
argv
)
==
2
:
host
=
sys
.
argv
[
1
]
queue
=
''
else
:
usage
()
check_queue
(
host
,
queue
)
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