mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-19 04:00:46 +00:00
6f6bb380ef
This may be used to output the JSON schema which describes the output of show info json and show stats json. The JSON output is without any extra whitespace in order to reduce the volume of output. For human consumption passing the output through a pretty printer may be helpful. e.g.: $ echo "show schema json" | socat /var/run/haproxy.stat stdio | \ python -m json.tool The implementation does not generate the schema. Some consideration could be given to integrating the output of the schema with the output of typed and json info and stats. In particular the types (u32, s64, etc...) and tags. A sample verification of show info json and show stats json using the schema is as follows. It uses the jsonschema python module: cat > jschema.py << __EOF__ import json from jsonschema import validate from jsonschema.validators import Draft3Validator with open('schema.txt', 'r') as f: schema = json.load(f) Draft3Validator.check_schema(schema) with open('instance.txt', 'r') as f: instance = json.load(f) validate(instance, schema, Draft3Validator) __EOF__ $ echo "show schema json" | socat /var/run/haproxy.stat stdio > schema.txt $ echo "show info json" | socat /var/run/haproxy.stat stdio > instance.txt python ./jschema.py $ echo "show stats json" | socat /var/run/haproxy.stat stdio > instance.txt python ./jschema.py Signed-off-by: Simon Horman <horms@verge.net.au> |
||
---|---|---|
.. | ||
common | ||
import | ||
proto | ||
types |