Welcome to temBoard agent documentation!¶
Installation and configuration¶
Installation from sources¶
Dependencies¶
python
2.7python-setuptools
>= 0.6
Installation¶
First install Python setuptools with pip:
sudo pip install setuptools
Proceed with the installation of the agent:
cd temboard-agent/
sudo cp -r share/ /usr/share/temboard-agent
sudo python setup.py install
Prepare directories and files¶
Creation of directories for configuration and SSL files:
sudo mkdir /etc/temboard-agent
sudo mkdir /etc/temboard-agent/ssl
Home directory:
sudo mkdir /var/lib/temboard-agent
sudo mkdir /var/lib/temboard-agent/main
Logging directory:
sudo mkdir /var/log/temboard-agent
Copy the sample configuration file:
sudo cp /usr/share/temboard-agent/temboard-agent.conf.sample /etc/temboard-agent/temboard-agent.conf
Copy the logrotate configuration file:
sudo cp /usr/share/temboard-agent/temboard-agent.logrotate /etc/logrotate.d/temboard-agent
Change owner and rights:
sudo chown -R postgres:postgres /var/lib/temboard-agent
sudo chown postgres:postgres /var/log/temboard-agent
sudo chown -R postgres:postgres /etc/temboard-agent
sudo chmod 0600 /etc/temboard-agent/temboard-agent.conf
Configuration¶
Before starting the agent, see Configuration for post-installation tasks.
Operating the agent¶
Start¶
sudo -u postgres temboard-agent -d -p /var/lib/temboard-agent/main/temboard-agent.pid
Stop¶
sudo kill $(cat /var/lib/temboard-agent/main/temboard-agent.pid)
Reload configuration¶
sudo kill -HUP $(cat /var/lib/temboard-agent/main/temboard-agent.pid)
Smoke test¶
Start the agent, then try:
curl -k https://127.0.0.1:2345/discover
curl -k -X POST -H "Content-Type: application/json" -d '{"username": "<username>", "password": "<password>"}' https://127.0.0.1:2345/login
Functional tests¶
sudo apt-get install python-rednose python-nose
cd temboard-agent/test
TBD_PGBIN="/usr/pgsql-9.6/bin" nosetests --rednose -v test_*
Configuration¶
Key & Hostname¶
In the temboard-agent.conf
file, 2 important parameters must be configured to make the agent interact with the central server:
- The
hostname
is used to identify the Agent. It must be a unique and fully qualified domain name ( e.g.db1.mydomain.foo
). Note thatlocalhost
is not a valid value for this parameter. - The
key
is used to authenticate the Agent. It must be a long series of characters and you must keep it secret. The best way to configure the agent key is to generate a random string of letters and digits:
cat /dev/urandom | tr -dc '[:alnum:]' | fold -w 64 | head -1
SSL certificate¶
temboard-agent embeds a lightweight HTTPS server aimed to serve its API, thus it is required to use a SSL certificate. As long as the agent’s API is not reachable through a public interface, usage of self-signed certificates is safe.
Using provided SSL certificate¶
It provides a ready to use self-signed SSL certifcate located in /usr/share/temboard-agent
directory, if you don’t want to use it, you can create a new one with the openssl
binary.
sudo cp /usr/share/temboard-agent/temboard-agent_CHANGEME.key /etc/temboard-agent/ssl/.
sudo cp /usr/share/temboard-agent/temboard-agent_CHANGEME.pem /etc/temboard-agent/ssl/.
sudo chown postgres:postgres /etc/temboard-agent/ssl/*
Build a new self-signed certificate¶
To build a new SSL certifcate:
sudo -u postgres openssl req -new -x509 -days 365 -nodes -out /etc/temboard-agent/ssl/localhost.pem -keyout /etc/temboard-agent/ssl/localhost.key
Then, ssl_cert_file
and ssl_key_file
parameters from temboard-agent.conf
file need to be set respectively to /etc/temboard-agent/ssl/localhost.pem
and /etc/temboard-agent/ssl/localhost.key
.
CA certificate file¶
monitoring
plugin sends data to the collector (API served by the temBoard UI web server) through HTTPS. To allow this data flow, HTTPS client implemented by the agent needs to have UI’s SSL certifcate (.pem) stored in its CA certificate file. temBoard agent embeds a default CA cert. file containing default temBoard UI SSL certificate.
sudo cp /usr/share/temboard-agent/temboard-agent_ca_certs_CHANGEME.pem /etc/temboard-agent/ssl/ca_certs_localhost.pem
ssl_ca_cert_file
parameter in section [monitoring]
from the configuration file needs to be set to /etc/temboard-agent/ssl/ca_certs_localhost.pem
.
Restrictions on SSL files¶
sudo chmod 0600 /etc/temboard-agent/ssl/*
Access to PostgreSQL Cluster¶
The agent needs a PostgreSQL superuser. By default, it is configured to work with postgres
user.
To create a dedicated one with password authentication:
sudo -u postgres createuser temboard -s -P
This superuser should be able to connect to the cluster through the unix socket using a password, check pg_hba.conf
file and reload configuration.
Example of pg_hba.conf
entry:
local postgres temboard md5
The access to the PostgreSQL cluster is then configured in the [postgresql]
section of the /etc/temboard-agent/temboard-agent.conf
file.
Users¶
When interacting with the agent using HTTP, for example when accessing certain pages in the Web UI, an authentication is required. Accounts are created using the tool: temboard-agent-adduser
.
Add a first user:
sudo -u postgres temboard-agent-adduser
Registration in the Web UI of the monitoring plugin¶
If you want to use the monitoring
plugin, you need to setup the collector_url
. It lets the agent know where to post its data.
Just change the hostname to point to the server. Since the Server is only reachable using HTTPS, the UI SSL certificate
(or CA certificates that has issued it) must be in the filepath where ssl_ca_cert_file
points.
The configuration file¶
- The configuration file
temboard-agent.conf
is formated using INI format. Configuration parameters are distributed under sections: [temboard]
: this is the main section grouping core parameters;[postgresql]
: parameters related to the PostgreSQL cluster that the agent is connected to;[logging]
: how and where to log;[dashboard]
: parameters of the plugindashboard
;[monitoring]
: pluginmonitoring
;[administration]
: pluginadministration
.
temboard
section¶
port
: port number that the agent will listen on to serve itsHTTP API
. Default:2345
;address
: IP v4 address that the agent will listen on. Default:0.0.0.0
(all);users
: Path to the file containing the list of the users allowed to use theHTTP API
. Default:/etc/temboard-agent/users
;plugins
: Array of plugin (name) to load. Default:["monitoring", "dashboard", "pgconf", "administration", "activity"]
;ssl_cert_file
: Path to SSL certificate file (.pem) for the embeded HTTPS process serving the API. Default:/etc/temboard-agent/ssl/temboard-agent_CHANGEME.pem
;ssl_key_file
: Path to SSL private key file. Default:/etc/temboard-agent/ssl/temboard-agent_CHANGEME.key
;home
: Path to agent home directory, it contains files used to store temporary data. When running multiple agents on the same host, each agent must have its own home directory. Default:/var/lib/temboard-agent/main
.hostname
: Overrides real machine hostname. Must be a valid FQDN. Default:None
;
postgresql
section¶
host
: Path to PostgreSQL unix socket. Default:/var/run/postgresql
;port
: PostgreSQL port number. Default:5432
;user
: PostgreSQL user. Must be a super-user. Default:postgres
;password
: User password. Default:None
;dbname
: Database name for the connection. Default:postgres
;instance
: Cluster name. Default:main
.key
: Authentication key used to send data to the UI. Default:None
;
logging
section¶
method
: Method used to send the logs:stderr
,syslog
orfile
. Default:syslog
;facility
: Syslog facility. Default:local0
;destination
: Path to the log file. Default:/dev/log
;level
: Log level, can be set toDEBUG
,INFO
,WARNING
,ERROR
orCRITICAL
. Default:INFO
.
dashboard
plugin¶
scheduler_interval
: Time interval, in second, between each run of the process collecting data used to render the dashboard. Default:2
;history_length
: Number of record to keep. Default:20
.
monitoring
plugin¶
dbnames
: Database name list (comma separated) to supervise. * for all. Default:*
;collector_url
: Collector URL. Default:None
;probes
: List of probes to run (comma separated). * for all. Default:*
;scheduler_interval
: Interval, in second, between each run of the process executing the probes. Default:60
;ssl_ca_cert_file
: File where to store collector’s SSL certificate. Default:None
.
administration
plugin¶
pg_ctl
: External command used to start/stop PostgreSQL. Default:None
.
Contributing¶
Reporting Issue & Submitting a Patch¶
We use dalibo/temboard-agent to
track issue and review contribution. Fork the main repository and open a PR
against master
as usual.
Docker Development Environment¶
With Docker & Compose, you can run your code like this:
$ docker-compose up -d
$ docker-compose exec agent bash
# pip install -e /usr/local/src/temboard-agent/
# gosu temboard temboard-agent -c /etc/temboard-agent/temboard-agent.conf
Goto https://0.0.0.0:8888/ to add your instance with address agent
, port
2345
and key key_for_agent_dev
.
That’s it !
Releasing¶
Releasing a new version of temBoard agent requires write access to master on main repository, PyPI project and Docker Hub repository.
Please follow these steps:
- Choose the next version according to PEP 440 .
- Update
setup.py
, without committing. - Generate commit and tag with
make release
. - Push commit to master and tag with
git push
andgit push --tags
. - Push Python egg to PyPI using
make upload
. - Trigger docker master build from https://hub.docker.com/r/dalibo/temboard-agent/~/settings/automated-builds/.
REST API documentation¶
Core API¶
-
POST
/login
¶ User login
Example request:
POST /login HTTP/1.1 Content-Type: application/json { "username": "alice", "password": "foo!!" }
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:19:48 GMT Content-type: application/json {"session": "fa452548403ac53f2158a65f5eb6db9723d2b07238dd83f5b6d9ca52ce817b63"}
Request Headers: - Content-Type –
application/json
Status Codes: - 200 OK – no error
- 404 Not Found – invalid username or password
- 500 Internal Server Error – internal error
- 406 Not Acceptable – username or password malformed or missing
Error responses:
HTTP/1.0 404 Not Found Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:20:33 GMT Content-type: application/json {"error": "Invalid username/password."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:21:01 GMT Content-type: application/json {"error": "Parameter 'password' is malformed."}
- Content-Type –
-
GET
/logout
¶ User logout
Example request:
GET /logout HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:33:19 GMT Content-type: application/json {"logout": true}
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session ID
- 500 Internal Server Error – internal error
- 406 Not Acceptable – session ID malformed
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:36:33 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:37:23 GMT Content-type: application/json {"error": "Parameter 'X-Session' is malformed."}
-
GET
/discover
¶ Get global informations about the environment
Example request:
GET /discover HTTP/1.1
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:33:19 GMT Content-type: application/json { "hostname": "neptune", "pg_data": "/var/lib/postgresql/9.4/main", "pg_port": 5432, "plugins": ["monitoring", "dashboard", "pgconf", "administration", "activity"], "memory_size": 8241508352, "pg_version": "PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2, 64-bit", "cpu": 4 }
Status Codes: - 200 OK – no error
- 500 Internal Server Error – internal error
-
GET
/profile
¶ Get current username
Example request:
GET /profile HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:33:19 GMT Content-type: application/json { "username": "alice" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session ID
- 500 Internal Server Error – internal error
- 406 Not Acceptable – session ID malformed
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:36:33 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:37:23 GMT Content-type: application/json {"error": "Parameter 'X-Session' is malformed."}
-
GET
/notifications
¶ Get all notifications from the agent.
Example request:
GET /notifications HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:33:19 GMT Content-type: application/json [ {"date": "2016-04-11T16:12:38", "username": "alice", "message": "Login"}, {"date": "2016-04-11T16:02:03", "username": "alice", "message": "Login"}, {"date": "2016-04-11T15:51:15", "username": "alice", "message": "HBA file version '2016-04-11T15:32:53' removed."}, {"date": "2016-04-11T15:51:10", "username": "alice", "message": "HBA file version '2016-04-11T15:47:26' removed."}, {"date": "2016-04-11T15:51:04", "username": "alice", "message": "HBA file version '2016-04-11T15:48:50' removed."}, {"date": "2016-04-11T15:50:57", "username": "alice", "message": "PostgreSQL reload"}, {"date": "2016-04-11T15:50:57", "username": "alice", "message": "HBA file updated"}, {"date": "2016-04-11T15:48:50", "username": "alice", "message": "PostgreSQL reload"} ]
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session ID
- 500 Internal Server Error – internal error
- 406 Not Acceptable – session ID malformed
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:36:33 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 12:37:23 GMT Content-type: application/json {"error": "Parameter 'X-Session' is malformed."}
Administration plugin API¶
-
POST
/administration/control
¶ Control PostgreSQL server. Supported actions are “start”, “stop”, “restart” and “reload”.
Example request:
POST /administration/control HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e Content-Type: application/json { "action": "restart" }
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Content-type: application/json { "action": "restart", "state": "ok" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header or parameter is malformed.
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Parameter 'action' is malformed."}
Activity plugin API¶
-
GET
/activity
¶ Get list of PostgreSQL backends.
Example request:
GET /activity HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "rows": [ { "pid": 6285, "database": "postgres", "user": "postgres", "client": null, "cpu": 0.0, "memory": 0.13, "read_s": "0.00B", "write_s": "0.00B", "iow": "N", "wait": "N", "duration": "1.900", "state": "idle", "query": "SELECT 1;" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Parameter 'X-Session' is malformed."}
-
GET
/activity/waiting
¶ Get list of PostgreSQL backends waiting for lock acquisition.
Example request:
GET /activity/waiting HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "rows": [ { "pid": 13532, "database": "test", "user": "postgres", "cpu": 0.0, "memory": 0.16, "read_s": "0.00B", "write_s": "0.00B", "iow": "N", "relation": " ", "type": "transactionid", "mode": "ShareLock", "state": "active", "duration": 4.35, "query": "DELETE FROM t1 WHERE id = 1;" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/activity/blocking
¶ Get list of PostgreSQL backends blocking other backends due to lock acquisition.
Example request:
GET /activity/blocking HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "rows": [ { "pid": 13309, "database": "test", "user": "postgres", "cpu": 0.0, "memory": 0.2, "read_s": "0.00B", "write_s": "0.00B", "iow": "N", "relation": " ", "type": "transactionid", "mode": "ExclusiveLock", "state": "idle in transaction", "duration": 4126.98, "query": "UPDATE t1 SET id = 100000000 where id =1;" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
POST
/activity/kill
¶ Terminate (kill) a list of PostgreSQL backends.
Example request:
POST /activity/kill HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e Content-Type: application/json { "pids": [ 13309 ] }
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "backends": [ {"pid": 13309, "killed": true}, ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Dashboard plugin API¶
-
GET
/dashboard
¶ Get the whole last data set used to render dashboard view. Data have been collected async.
GET /dashboard HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Content-type: application/json { "active_backends": { "nb": 1, "time": 1429617751.29224 }, "loadaverage": 0.28, "os_version": "Linux 3.16.0-34-generic x86_64", "pg_version": "9.4.1", "n_cpu": "4", "hitratio": 98.0, "databases": { "total_size": "1242 MB", "time": "14:02", "databases": 4, "total_commit": 16728291, "total_rollback": 873 }, "memory": { "total": 3950660, "active": 46.9, "cached": 20.2, "free": 32.9 }, "hostname": "neptune", "cpu": { "iowait": 0.0, "idle": 97.5, "steal": 0.0, "user": 2.5, "system": 0.0 }, "buffers": { "nb": 348247, "time": 1429617751.276508 } }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Parameter 'X-Session' is malformed."}
-
GET
/dashboard/live
¶ Synchronous version of
/dashboard
. Please refer to/dashboard
API documentation for details.
-
GET
/dashboard/history
¶ Get the last
n
sets of dashboard data.n
is defined by parameterhistory_length
from thedashboard
section of configuration file. Default value is20
.GET /dashboard/history HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 15:56:56 GMT Access-Control-Allow-Origin: * Content-type: application/json [ { "active_backends": { "nb": 1, "time": 1492703660.798522 }, "databases": { "total_rollback": 1081, "total_size": "158 MB", "timestamp": 1492703660.913077, "time": "17:54", "total_commit": 2825374, "databases": 6 }, "hostname": "poseidon.home.priv", "pg_version": "PostgreSQL 9.5.5 on x86_64-pc-linux-gnu, compiled by x86_64-pc-linux-gnu-gcc (Gentoo 4.9.4 p1.0, pie-0.6.4) 4.9.4, 64-bit", "memory": { "active": 51.0, "cached": 29.5, "total": 8082124, "free": 19.5 }, "cpu": { "iowait": 0.0, "idle": 100.0, "steal": 0.0, "user": 0.0, "system": 0.0 }, "os_version": "Linux 4.9.6-gentoo-r1", "loadaverage": 0.18, "hitratio": 99.0, "pg_uptime": "01:50:31.573788", "pg_port": "5432", "n_cpu": 4, "pg_data": "/var/lib/postgresql/9.5/data", "buffers": { "nb": 27670, "time": 1492703660.784254 } } ]
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/buffers
¶ Get the number of buffers allocated by PostgreSQL
background writer
process.GET /dashboard/buffers HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:09:58 GMT Access-Control-Allow-Origin: * Content-type: application/json {"buffers": {"nb": 27696, "time": 1492704598.784161}}
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/hitratio
¶ Get PostgreSQL global cache hit ratio.
GET /dashboard/hitratio HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:28:33 GMT Access-Control-Allow-Origin: * Content-type: application/json {"hitratio": 99.0}
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/active_backends
¶ Get the total number of active backends.
GET /dashboard/active_backends HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:35:55 GMT Access-Control-Allow-Origin: * Content-type: application/json { "active_backends": { "nb": 1, "time": 1492706155.986045 } }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/cpu
¶ Get CPU usage.
GET /dashboard/cpu HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:40:46 GMT Access-Control-Allow-Origin: * Content-type: application/json { "cpu": { "iowait": 0.0, "idle": 100.0, "steal": 0.0, "user": 0.0, "system": 0.0 } }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/loadaverage
¶ System loadaverage.
GET /dashboard/loadaverage HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:44:04 GMT Access-Control-Allow-Origin: * Content-type: application/json { "loadaverage": 0.06 }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/memory
¶ Memory usage.
GET /dashboard/memory HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:46:39 GMT Access-Control-Allow-Origin: * Content-type: application/json { "memory": { "active": 50.1, "cached": 29.5, "total": 8082124, "free": 20.4 } }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/hostname
¶ Machine hostname.
GET /dashboard/hostname HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:48:49 GMT Access-Control-Allow-Origin: * Content-type: application/json { "hostname": "poseidon.home.priv" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/os_version
¶ Operating system version.
GET /dashboard/os_version HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:55:44 GMT Access-Control-Allow-Origin: * Content-type: application/json { "os_version": "Linux 4.9.6-gentoo-r1" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/pg_version
¶ Get PostgreSQL server version.
GET /dashboard/pg_version HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 16:59:26 GMT Access-Control-Allow-Origin: * Content-type: application/json { "pg_version": "PostgreSQL 9.5.5 on x86_64-pc-linux-gnu, compiled by x86_64-pc-linux-gnu-gcc (Gentoo 4.9.4 p1.0, pie-0.6.4) 4.9.4, 64-bit" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/n_cpu
¶ Number of CPU.
GET /dashboard/n_cpu HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 17:03:55 GMT Access-Control-Allow-Origin: * Content-type: application/json { "n_cpu": 4 }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/databases
¶ PostgreSQL cluster size & number of databases.
GET /dashboard/databases HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 17:08:59 GMT Access-Control-Allow-Origin: * Content-type: application/json { "databases": { "total_rollback": 1087, "total_size": "159 MB", "timestamp": 1492708139.981268, "databases": 6, "total_commit": 2848707, "time": "19:08" } }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/dashboard/info
¶ Get a bunch of global informations about system and PostgreSQL.
GET /dashboard/info HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Thu, 20 Apr 2017 17:17:57 GMT Access-Control-Allow-Origin: * Content-type: application/json { "hostname": "poseidon.home.priv", "os_version": "Linux 4.9.6-gentoo-r1", "pg_port": "5432", "pg_uptime": "03:14:08.029574", "pg_version": "PostgreSQL 9.5.5 on x86_64-pc-linux-gnu, compiled by x86_64-pc-linux-gnu-gcc (Gentoo 4.9.4 p1.0, pie-0.6.4) 4.9.4, 64-bit", "pg_data": "/var/lib/postgresql/9.5/data" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Monitoring plugin API¶
-
GET
/monitoring/probe/sessions
¶ Run
sessions
monitoring probe.Example request:
GET /monotoring/probe/sessions HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "sessions": [ { "idle_in_xact": 0, "idle_in_xact_aborted": 0, "no_priv": 0, "idle": 0, "datetime": "2017-04-21 08:24:45.003511+02", "disabled": 0, "waiting": 0, "port": 5432, "active": 0, "dbname": "temboard_test", "fastpath": 0 } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Parameter 'X-Session' is malformed."}
-
GET
/monitoring/probe/xacts
¶ Run
xacts
monitoring probe.Example request:
GET /monotoring/probe/xacts HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "xacts": [ { "port": 5432, "n_commit": 0, "n_rollback": 0, "dbname": "template1", "datetime": "2017-04-21 08:42:12.092111+02" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/locks
¶ Run
locks
monitoring probe.Example request:
GET /monotoring/probe/locks HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "locks": [ { "exclusive": 0, "waiting_share_row_exclusive": 0, "waiting_share": 0, "row_share": 0, "waiting_row_exclusive": 0, "share_row_exclusive": 0, "port": 5432, "share": 0, "waiting_access_share": 0, "dbname": "test", "row_exclusive": 0, "share_update_exclusive": 0, "access_share": 0, "access_exclusive": 0, "waiting_exclusive": 0, "siread": 0, "datetime": "2017-04-21 08:55:11.768602+02", "waiting_share_update_exclusive": 0, "waiting_row_share": 0, "waiting_access_exclusive": 0 } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/blocks
¶ Run
blocks
monitoring probe.Example request:
GET /monotoring/probe/blocks HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "blocks": [ { "blks_read": 382, "dbname": "postgres", "hitmiss_ratio": 99.9998294969873, "blks_hit": 224042580, "datetime": "2017-04-21 08:57:32.11277+02", "port": 5432 } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/bgwriter
¶ Run
bgwriter
monitoring probe.Example request:
GET /monotoring/probe/bgwriter HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "bgwriter": [ { "checkpoint_write_time": 15113301.0, "checkpoints_timed": 1960, "buffers_alloc": 29369, "buffers_clean": 0, "buffers_backend_fsync": 0, "checkpoint_sync_time": 177464.0, "checkpoints_req": 0, "port": 5432, "buffers_backend": 42258, "maxwritten_clean": 0, "datetime": "2017-04-21 08:59:20.171443+02", "buffers_checkpoint": 149393, "stats_reset": "2017-04-14 13:37:15.288701+02" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/db_size
¶ Run
db_size
monitoring probe.Example request:
GET /monotoring/probe/db_size HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "db_size": [ { "port": 5432, "size": 7021060, "dbname": "template1", "datetime": "2017-04-21 09:00:47.528365+02" }, { "port": 5432, "size": 7168172, "dbname": "postgres", "datetime": "2017-04-21 09:00:47.528365+02" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/tblspc_size
¶ Run
tblspc_size
monitoring probe.Example request:
GET /monotoring/probe/tblspc_size HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "tblspc_size": [ { "size": 181067120, "port": 5432, "spcname": "pg_default", "datetime": "2017-04-21 09:13:55.196718+02" }, { "size": 622400, "port": 5432, "spcname": "pg_global", "datetime": "2017-04-21 09:13:55.196718+02" }, { "size": null, "port": 5432, "spcname": "tbs", "datetime": "2017-04-21 09:13:55.196718+02" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/filesystems_size
¶ Run
filesystems_size
monitoring probe.Example request:
GET /monotoring/probe/filesystems_size HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "filesystems_size": [ { "device": "udev", "total": 10485760, "mount_point": "/dev", "used": 4096, "datetime": "2017-04-21 07:16:25 +0000" }, { "device": "/dev/sda4", "total": 21003628544, "mount_point": "/", "used": 11889070080, "datetime": "2017-04-21 07:16:25 +0000" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/cpu
¶ Run
cpu
monitoring probe.Example request:
GET /monotoring/probe/cpu HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "cpu": [ { "time_system": 140, "time_steal": 0, "time_iowait": 10, "datetime": "2017-04-21 08:09:27 +0000", "measure_interval": 27.88518500328064, "time_idle": 27410, "cpu": "cpu0", "time_user": 290 }, { "time_system": 110, "time_steal": 0, "time_iowait": 10, "datetime": "2017-04-21 08:09:27 +0000", "measure_interval": 27.885642051696777, "time_idle": 27410, "cpu": "cpu1", "time_user": 290 }, { "time_system": 170, "time_steal": 0, "time_iowait": 1390, "datetime": "2017-04-21 08:09:27 +0000", "measure_interval": 27.885895013809204, "time_idle": 26040, "cpu": "cpu2", "time_user": 220 }, { "time_system": 130, "time_steal": 0, "time_iowait": 20, "datetime": "2017-04-21 08:09:27 +0000", "measure_interval": 27.88606309890747, "time_idle": 27370, "cpu": "cpu3", "time_user": 320 } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/process
¶ Run
process
monitoring probe.Example request:
GET /monotoring/probe/process HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "process": [ { "measure_interval": 55.731096029281616, "procs_total": "486", "forks": 165, "procs_blocked": 0, "context_switches": 31453, "procs_running": 4, "datetime": "2017-04-21 08:13:56 +0000" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/memory
¶ Run
memory
monitoring probe.Example request:
GET /monotoring/probe/memory HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "memory": [ { "mem_used": 7268151296, "swap_used": 0, "swap_total": 4026527744, "mem_total": 8276094976, "mem_cached": 2464796672, "mem_free": 1007943680, "mem_buffers": 558067712, "datetime": "2017-04-21 08:15:06 +0000" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/loadavg
¶ Run
loadavg
monitoring probe.Example request:
GET /monotoring/probe/loadavg HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "loadavg": [ { "load1": "0.07", "load15": "0.09", "load5": "0.16", "datetime": "2017-04-21 08:16:16 +0000" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/monitoring/probe/wal_files
¶ Run
wal_files
monitoring probe.Example request:
GET /monotoring/probe/wal_files HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.12 Date: Fri, 21 Apr 2017 06:24:45 GMT Access-Control-Allow-Origin: * Content-type: application/json { "wal_files": [ { "archive_ready": 0, "total_size": 201326592.0, "written_size": 13648, "datetime": "2017-04-21 08:17:12 +0000", "measure_interval": 9.273101091384888, "current_location": "53/700035B0", "total": 12, "port": 5432 } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
PgConf plugin API¶
-
GET
/pgconf/configuration
¶ Get PostgreSQL settings from
pg_settings
system view and configuration files.Example request:
GET /pgconf/configuration HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json [ { "category": "Autovacuum", "rows": [ { "context": "sighup", "enumvals": null, "max_val": null, "vartype": "bool", "auto_val": "off", "auto_val_raw": "off", "boot_val": "on", "unit": null, "desc": "Starts the autovacuum subprocess.", "name": "autovacuum", "min_val": null, "setting": "off", "setting_raw": "off", "file_val": null, "file_val_raw": null } ] } ]
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Error responses:
HTTP/1.0 401 Unauthorized Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:58:00 GMT Content-type: application/json {"error": "Parameter 'X-Session' is malformed."}
-
GET
/pgconf/configuration/categories
¶ Get list of settings categories.
Example request:
GET /pgconf/configuration/categories HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "categories": [ "Autovacuum", "Client Connection Defaults / Locale and Formatting", "Client Connection Defaults / Other Defaults" ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
POST
/pgconf/configuration
¶ Update one or many PostgreSQL settings values. This API issues
ALTER SYSTEM
SQL statements.Example request:
POST /pgconf/configuration HTTP/1.1 Content-Type: application/json X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e { "settings": [ { "name": "autovacuum", "setting": "on" } ] }
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "settings": [ { "setting": "on", "restart": false, "name": "autovacuum", "previous_setting": "off" } ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
or setting item is malformed. - 400 Bad Request – invalid JSON format.
-
GET
/pgconf/configuration/category/(^.{1,128}$)
¶ Get list of settings for one category, based on category name.
Example request:
GET /pgconf/configuration/category/Autovacuum HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json [ { "category": "Autovacuum", "rows": [ { "context": "sighup", "enumvals": null, "max_val": null, "vartype": "bool", "auto_val": "on", "auto_val_raw": "on", "boot_val": "on", "unit": null, "desc": "Starts the autovacuum subprocess. ", "name": "autovacuum", "min_val": null, "setting": "on", "setting_raw": "on", "file_val": null, "file_val_raw": null } ] } ]
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/pgconf/configuration/status
¶ Shows settings waiting for PostgreSQL server reload and/or restart
Example request:
GET /pgconf/configuration/status HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "restart_changes": [ { "context": "postmaster", "setting_raw": "128MB", "enumvals": null, "max_val": 1073741823, "vartype": "integer", "auto_val": 32768, "file_val_raw": "128MB", "boot_val": 1024, "unit": "8kB", "desc": "Sets the number of shared memory buffers used by the server. ", "name": "shared_buffers", "auto_val_raw": "256MB", "min_val": 16, "setting": 16384, "file_val": 16384, "pending_val": "256MB" } ], "restart_pending": true, "reload_pending": false, "reload_changes": [] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/pgconf/hba
¶ Get records from the
pg_hba.conf
file.Example requests:
GET /pgconf/hba HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
GET /pgconf/hba?version=2017-03-06T16:34:07 HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "entries": [ { "comment": " \"local\" is for Unix domain socket connections only" }, { "database": "all", "auth_options": "", "connection": "local", "user": "alice", "address": "", "auth_method": "trust" }, { "database": "all", "auth_options": "", "connection": "local", "user": "all", "address": "", "auth_method": "trust" } ], "version": null, "filepath": "/etc/postgresql-9.5/pg_hba.conf" }
Query Parameters: - version –
pg_hba.conf
file version to get. Ex:2017-03-06T16:34:07
. If not set then the current version is read.
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 404 Not Found –
version
does not exist - 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Error responses:
HTTP/1.0 404 Not Found Server: temboard-agent/0.0.1 Python/2.7.9 Date: Thu, 11 Feb 2016 09:04:02 GMT Access-Control-Allow-Origin: * Content-type: application/json {"error": "Version 2016-01-29T08:46:09 of file /etc/postgresql/9.4/main/pg_hba.conf does not exist."}
- version –
-
GET
/pgconf/hba/raw
¶ Get raw content of
pg_hba.conf
file.Example requests:
GET /pgconf/hba/raw HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
GET /pgconf/hba/raw?version=2017-03-06T16:34:07 HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "content": "# \"local\" is for Unix domain socket connections only\r\nlocal all julien trust \r\nlocal all all trust \r\n# IPv4 local connections:\r\nhost all all 127.0.0.1/32 trust \r\n# IPv6 local connections:\r\nhost all all ::1/128 trust \r\n", "version": null, "filepath": "/etc/postgresql-9.5/pg_hba.conf" }
Query Parameters: - version –
pg_hba.conf
file version to get. Ex:2017-03-06T16:34:07
. If not set then the current version is read.
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 404 Not Found –
version
does not exist - 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Error responses:
HTTP/1.0 404 Not Found Server: temboard-agent/0.0.1 Python/2.7.9 Date: Thu, 11 Feb 2016 09:04:02 GMT Access-Control-Allow-Origin: * Content-type: application/json {"error": "Version 2016-01-29T08:46:09 of file /etc/postgresql/9.4/main/pg_hba.conf does not exist."}
- version –
-
POST
/pgconf/hba
¶ Writes
pg_hba.conf
file content.Example request:
POST /pgconf/hba HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e Content-Type: application/json { "entries": [ { "connection": "local", "user": "all", "database": "all", "auth_method": "peer" } ], "new_version": true }
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "last_version": "2016-02-11T15:26:19", "filepath": "/etc/postgresql/9.4/main/pg_hba.conf" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
POST
/pgconf/hba/raw
¶ Writes
pg_hba.conf
file content. Raw mode.Example request:
POST /pgconf/hba/raw HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e Content-Type: application/json { "content": "local all all md5\r\n ... ", "new_version": true }
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "last_version": "2016-02-11T15:26:19", "filepath": "/etc/postgresql/9.4/main/pg_hba.conf" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
DELETE
/pgconf/hba
¶ Remove a version of
pg_hba.conf
file.Example requests:
DELETE /pgconf/hba?version=2017-03-06T16:34:07 HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "deleted": true, "version": "2016-01-29T08:44:26" }
Query Parameters: - version –
pg_hba.conf
file version to remove. Ex:2017-03-06T16:34:07
.
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 404 Not Found –
version
does not exist - 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
Error responses:
HTTP/1.0 404 Not Found Server: temboard-agent/0.0.1 Python/2.7.9 Date: Thu, 11 Feb 2016 09:04:02 GMT Access-Control-Allow-Origin: * Content-type: application/json {"error": "Version 2016-01-29T08:46:09 of file /etc/postgresql/9.4/main/pg_hba.conf does not exist."}
- version –
-
GET
/pgconf/hba/versions
¶ Get the list of
pg_hba.conf
versions.Example requests:
GET /pgconf/hba/version HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "versions": [ "2016-02-11T18:01:35", "2016-02-11T16:43:51", "2016-02-11T16:43:36" ], "filepath": "/etc/postgresql/9.4/main/pg_hba.conf" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/pgconf/pg_ident
¶ Get raw content of
pg_ident.conf
fileExample requests:
GET /pgconf/pg_ident HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "content": "# PostgreSQL User Name Maps\r\n# =========================\r\n ... ", "filepath": "/etc/postgresql/9.4/main/pg_ident.conf" }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
POST
/pgconf/pg_ident
¶ Write
pg_ident.conf
file content. Raw mode.Example request:
POST /pgconf/pg_ident HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e Content-Type: application/json { "content": "# PostgreSQL User Name Maps\r\n ..." }
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "update": true }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.
-
GET
/pgconf/hba/options
¶ Get HBA potential values for each column.
Example requests:
GET /pgconf/hba/options HTTP/1.1 X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK Server: temboard-agent/0.0.1 Python/2.7.8 Date: Wed, 22 Apr 2015 09:57:52 GMT Access-Control-Allow-Origin: * Content-type: application/json { "connection": [ "local", "host", "hostssl", "hostnossl" ], "database": [ "all", "sameuser", "samerole", "db1" ], "user": [ "all", "user1", "+group1" ], "auth_method": [ "trust", "reject" ] }
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session
- 500 Internal Server Error – internal error
- 406 Not Acceptable – header
X-Session
is malformed.