Skip to content

Commit 3f52668

Browse files
committed
Remove Upstart config and minor clean up
1 parent a2b88b5 commit 3f52668

File tree

5 files changed

+29
-52
lines changed

5 files changed

+29
-52
lines changed

README.md

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Service to extract and provide metrics on your PostgreSQL database.
44

55
This tool is a CLI (command line) tool that can be called to extract
6-
statistics and create metrics regarding your PostgreSQL database cluster.
6+
statistics and create metrics from your PostgreSQL database cluster.
77
CLI is runnable in long running process mode, which will periodically
88
send the gathered metrics forward.
99

@@ -12,10 +12,10 @@ compatible JSON, which is created by a set of functions listed in
1212
the configuration file.
1313

1414
The extracted metrics can be printed out as direct output of
15-
the CLI tool or sent out of the host, where the postgresql-metrics
16-
process is running using [FFWD](https://github.com/spotify/ffwd).
15+
the CLI tool, or sent out of the host the postgresql-metrics
16+
process is running in using [FFWD](https://github.com/spotify/ffwd).
1717

18-
Notice that the [FFWD](https://github.com/spotify/ffwd) format is
18+
The [FFWD](https://github.com/spotify/ffwd) format is
1919
plain JSON sent over a UDP socket, so you can use whatever
2020
UDP socket endpoint, which understands JSON, to consume the metrics.
2121

@@ -30,28 +30,26 @@ technologies.
3030

3131
* Python 2.7
3232
* PostgreSQL 9.3 or later
33-
* Debian based distribution with Upstart or systemd, if you want to use the packaging functionality
33+
* Debian based distribution with systemd (packaging requirement only)
3434

3535

3636
## Building and Installing
3737

38-
You can build a Debian package out of this by calling *debuild* in project
39-
root, e.g.:
38+
You can build a Debian package by running the following in project root:
4039

4140
```
42-
debuild -us -uc -b
41+
dpkg-buildpackage -us -uc -b
4342
```
4443

45-
Notice that postgresql-metrics includes by default an Upstart script or systemd
46-
service to run as long running process, pushing metrics to FFWD as gathered.
44+
Notice that postgresql-metrics includes by default a systemd service to
45+
run as long running process, pushing metrics to FFWD as gathered.
4746
You need to stop the long running process after installing the package for configuration.
4847

4948
```
50-
sudo stop postgresql-metrics
49+
sudo systemctl stop postgresql-metrics
5150
```
5251

53-
Notice that by default Upstart processes log under */var/log/upstart/*, if you
54-
want to debug the process. For the systemd service, you can run
52+
If you want to debug the process. For the systemd service, you can run
5553
*sudo journalctl -u postgresql-metrics* to see the service's log.
5654

5755
### Edit Configuration
@@ -67,8 +65,8 @@ keep using a single configuration file.
6765

6866
Edit at least the values under *postgres* section in the configuration to
6967
match your PostgreSQL cluster setup. Remember also to list the *databases*
70-
you want to gather metrics from. Notice that by database in this context
71-
we mean a database name you created within your PostgreSQL cluster.
68+
you want to gather metrics from. By database in this context we mean
69+
a database name you created within your PostgreSQL cluster.
7270

7371
### Prepare Database
7472

@@ -80,7 +78,7 @@ The configured metrics user will be also granted access to the created
8078
statistics functions and views.
8179

8280
You need to provide administrator user to the *prepare-db* call, which
83-
the tool is kind enough to ask. You don't need to provide credentials, if
81+
the tool is kind enough to ask. You don't need to provide credentials if
8482
you are running the *prepare-db* with a local user that is configured to be
8583
trusted locally by the PostgreSQL cluster (in *pg_hba.conf*), and is
8684
a super user, like the default *postgres* user created by some distribution
@@ -103,10 +101,10 @@ Add one line per database you are monitoring into the end of the *pg_hba.conf*
103101
file for your cluster:
104102

105103
```
106-
host my_database_name metrics_user_name 127.0.0.1/32 md5 # metrics user access
104+
host my_database_name postgresql_metrics_user 127.0.0.1/32 md5 # metrics user access
107105
```
108106

109-
Replace the *my_database_name* and *metrics_user_name* with the values you
107+
Replace the *my_database_name* and *postgresql_metrics_user* with the values you
110108
configured into the postgresql-metrics configuration in **Edit Configuration**
111109
step above.
112110

@@ -127,13 +125,7 @@ You need to call the command above as a user that has access to the WAL log
127125
directory under PostgreSQL, or the metric gathering WAL file amounts will fail.
128126
Single failed metric calls will not prevent the rest of gathering process.
129127

130-
You can also start the long running process again, if using Upstart:
131-
132-
```
133-
sudo start postgresql-metrics
134-
```
135-
136-
Likewise, if using systemd:
128+
You can also start the long running process again, if using systemd:
137129

138130
```
139131
sudo systemctl start postgresql-metrics
@@ -144,15 +136,14 @@ sudo systemctl start postgresql-metrics
144136
This section explains the metrics we gather using this tool.
145137

146138
Notice that there are many system specific metrics that you should gather
147-
in addition to the Postgres specific metrics. These kind of metrics we do
148-
not gather, that you should gather with other tools, are for example:
139+
in addition to the Postgres specific metrics, for example:
149140

150141
* CPU usage
151142
* Network usage, sent / received bytes per related network interface
143+
* Memory usage
152144
* Disk I/O operations
153145
* I/O await times
154-
* Disk usage amounts and free space left
155-
* Memory usage
146+
* Disk usage and free space left
156147

157148

158149
### Database Specific Metrics

debian/postgresql-metrics.upstart

Lines changed: 0 additions & 16 deletions
This file was deleted.

etc/postgresql-metrics/default/postgresql-metrics.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ db_functions:
4747
- ["get_stats_oldest_transaction_timestamp", 180]
4848
- ["get_stats_index_hit_rates", 60]
4949
# table bloat is a heavy query, which might take many minutes to execute for huge tables
50-
# 43200 = 12*60*60 = 12 hours
50+
# 43200 seconds = 12*60*60 seconds = 12 hours
5151
- ["get_stats_table_bloat", 43200]
5252
# replication status relies on `pg_stat_wal_receiver`, which is only available on postgres 9.6+
5353
# - ["get_stats_incoming_replication_status", 30]

etc/postgresql-metrics/postgresql-metrics.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
# Notice that this configuration will overwrite the configuration
3-
# in default folder, keeping the values in default, not overwritten here.
3+
# in default folder, keeping the unchanged values from default configuration.
44
postgres:
55
host: "127.0.0.1"
6-
user: "my_postgres_user"
7-
password: "my_secret"
6+
user: "postgresql_metrics_user"
7+
password: "postgresql_metrics_password"
88
databases:
99
- postgres
1010

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
from setuptools import find_packages
1515
from setuptools import setup
1616

17+
1718
def requirements(f):
18-
reqs = open(f, 'r').read().splitlines()
19-
reqs = [r for r in reqs if not r.strip().startswith('#')]
20-
return reqs
19+
reqs = open(f, 'r').read().splitlines()
20+
reqs = [r for r in reqs if not r.strip().startswith('#')]
21+
return reqs
22+
2123

2224
setup(name='postgresql-metrics',
2325
version='0.2.6',

0 commit comments

Comments
 (0)