Step 4: Install collector
For this final step, you first need to choose whether you want to install the collector
on an existing EC2 instance, or run a new one.
The collector is a daemon process that continuously collects database statistics as well
as other information from the RDS system, and submits them to the pganalyze dashboard
in recurring intervals.
Historically the pganalyze collector has been Python-based (invoked via cron), but for RDS access
you need to use our newer Go-based collector which runs as a daemon.
You can either run it on a tiny instance (a
t2.nano suffices), or add it to an existing EC2 instance in your environment.
Variant A: Starting a new EC2 instance
First, go back to Security Credentials and create a new IAM role that can be used by EC2 instances,
with the IAM policy that we created in the previous step.
It should look like this when reviewing:
Start a new
t2.nano instance, Amazon Linux based, that has this role applied:
Then follow the step to install the collector on Amazon Linux based instances.
Variant B: Giving access to an existing EC2 instance
In case you'd like to use an existing EC2 instance, there are two approaches you can choose:
- Add the IAM policy we created to your existing instance role
- Create a new IAM user, and manually supply the credentials (using the
If you know AWS a bit these should be straightforward to configure. Please reach out in case you run into issues.
Installing the collector on the instance
SSH into your EC2 instance, and run the following to download and install the package:
Run the following commands as root on your server:
echo "[pganalyze_collector] name=pganalyze_collector baseurl=https://packages.pganalyze.com/el/6 repo_gpgcheck=1 enabled=1 gpgkey=https://packages.pganalyze.com/pganalyze_signing_key.asc sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300" >> /etc/yum.repos.d/pganalyze_collector.repo yum makecache yum install pganalyze-collector
You can replace "el/6" with either "el/7" or "fedora/24" to get the correct package.
These repositories are updated by pganalyze whenever a new stable version of the collector is released.
Configure the collector
The collector configuration file lives in
/etc/pganalyze-collector.conf, and looks like this:
# Lines starting with # are comments [pganalyze] #api_key: your_api_key [server1] #db_name: mydb #db_username: myusername #db_password: mypassword #db_host: 127.0.0.1 #db_port: 5432 #aws_db_instance_id: your_rds_instance #aws_region: us-west-2 #aws_access_key_id: mykey #aws_secret_access_key: mysecret
Fill in the values step-by-step and remove the
# in the line when you fill in the values:
api_keycan be found in the pganalyze dashboard (on the API Keys page for your organization)
db_hostis the hostname of your RDS instance
db_nameis the database on the PostgreSQL server you want to monitor
db_passwordshould be the credentials of the monitoring user we created in Step 2 (or of a superuser, if you'd like)
aws_db_instance_idis the name shown as
DB Instance Identifierin the AWS console (usually chosen when you create the RDS instance)
In case you are not in
us-east-1 you will also need to add
aws_region and set it to e.g.
Also, in case you'd like to use an IAM user instead of the instance role, you'll need to supply
There are a few more advanced options, as well as the ability to specify multiple databases - see a more complex example file.
You can verify that the configuration is correct, by running the following command:
This will go through one cycle of collecting statistics information from both PostgreSQL and RDS,
as well as submitting it to the pganalyze dashboard (but not storing it).
If this is successful, all you should see is:
1999/01/01 08:04:32 I [pganalyze] Test submission successful (1010 KB received) - proceed running the collector as a daemon
Note that in some error cases the collector might still succeed - try to debug them nonetheless, or reach out to us for help.
In case the collector can't find the instance make sure that you've specified the correct
Reloading the daemon
If you've installed the package successfully, the daemon should have been running in the background already,
You can now issue a simple reload to get it to update its configuration:
sudo service pganalyze-collector reload
You can verify that the collector is running using
service pganalyze-collector status, this should return something like:
pganalyze-collector (pid 2395) is running...
The collector will also log every time data is sent to syslog/journald, which you can typically find in /var/log/messages or /var/log/syslog:
1999/01/01 15:50:03 I [pganalyze] Submitted snapshot successfully 1999/01/01 16:00:04 I [pganalyze] Submitted snapshot successfully 1999/01/01 16:10:13 I [pganalyze] Submitted snapshot successfully 1999/01/01 16:20:04 I [pganalyze] Submitted snapshot successfully
The dashboard should start showing data once at least two snapshots have been received from the collector daemon.
It is recommended you let the system run for 24 hours before giving it a detailed look, most views need a few
hours worth of data to show correctly and give you useful insights.
Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →