Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12945480
check-postgresql-xml-support.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
check-postgresql-xml-support.py
View Options
#!/usr/bin/env python3
# -------------------------------------------------------------
# Monitoring :: PostgreSQL :: XML support
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Checks if the PostgreSQL process has XML support
# License: BSD-2-Clause
# -------------------------------------------------------------
import
distutils.spawn
import
lddcollect
import
sys
# -------------------------------------------------------------
# Dependencies
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
has_lib
(
process
,
needed_lib
):
dependencies
=
lddcollect
.
lddtree
(
process
)
return
any
(
lib
.
startswith
(
needed_lib
)
for
lib
in
dependencies
[
"needed"
])
# -------------------------------------------------------------
# PostgreSQL locator
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
find_postgres
():
return
distutils
.
spawn
.
find_executable
(
"postgres"
)
# -------------------------------------------------------------
# Application entry point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
run
():
process
=
find_postgres
()
if
process
is
None
:
print
(
"UNKNOWN: can't find expected postgres process"
)
sys
.
exit
(
3
)
is_built_against_libxml
=
has_lib
(
process
,
"libxml2.so"
)
if
is_built_against_libxml
:
print
(
"OK"
)
sys
.
exit
(
0
)
print
(
"ERROR: PostgreSQL has no XML support through libxml2, PostgreSQL port MUST be rebuilt as soon as possible."
)
sys
.
exit
(
2
)
if
__name__
==
"__main__"
:
run
()
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Tue, Nov 18, 17:41 (22 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3176651
Default Alt Text
check-postgresql-xml-support.py (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment