Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
63ef0ac3
Commit
63ef0ac3
authored
Jan 05, 2015
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap the socket in a file
So we don't have to worry about incomplete sends or recvs.
parent
9be1c9a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/ZEO/nagios.py
src/ZEO/nagios.py
+7
-3
No files found.
src/ZEO/nagios.py
View file @
63ef0ac3
...
@@ -73,9 +73,13 @@ def check(addr, output_metrics, status, per):
...
@@ -73,9 +73,13 @@ def check(addr, output_metrics, status, per):
s
.
connect
(
addr
)
s
.
connect
(
addr
)
except
socket
.
error
:
except
socket
.
error
:
return
error
(
"Can't connect %s"
%
sys
.
exc_info
()[
1
])
return
error
(
"Can't connect %s"
%
sys
.
exc_info
()[
1
])
s
.
send
(
'
\
x00
\
x00
\
x00
\
x04
ruok'
)
fp
=
s
.
makefile
()
proto
=
s
.
recv
(
struct
.
unpack
(
">I"
,
s
.
recv
(
4
))[
0
])
fp
.
write
(
'
\
x00
\
x00
\
x00
\
x04
ruok'
)
datas
=
s
.
recv
(
struct
.
unpack
(
">I"
,
s
.
recv
(
4
))[
0
])
fp
.
flush
()
proto
=
fp
.
read
(
struct
.
unpack
(
">I"
,
fp
.
read
(
4
))[
0
])
datas
=
fp
.
read
(
struct
.
unpack
(
">I"
,
fp
.
read
(
4
))[
0
])
fp
.
close
()
s
.
close
()
data
=
json
.
loads
(
datas
)
data
=
json
.
loads
(
datas
)
if
not
data
:
if
not
data
:
return
warn
(
"No storages"
)
return
warn
(
"No storages"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment