-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to latest postgres and node exporters
- Loading branch information
1 parent
964f70a
commit ab46f64
Showing
3 changed files
with
33 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,34 +7,38 @@ Set up common prometheus exporter configurations | |
``` | ||
- src: [email protected]:smartlogic/ansible-role-prometheus-exporters | ||
name: prometheus-exporters | ||
version: 0.5.3 | ||
version: 1.0.0 | ||
``` | ||
|
||
## Requirements | ||
|
||
### For postgres_exporter | ||
|
||
Set up permission for the prometheus user (by default) to have access to the necessary stats | ||
Set up permission for the postgres_exporter user (by default) to have access to the necessary stats, update the password to something more secure | ||
|
||
```sql | ||
CREATE USER prometheus; | ||
CREATE DATABASE prometheus; | ||
ALTER USER prometheus SET SEARCH_PATH TO prometheus,pg_catalog; | ||
|
||
-- If deploying as non-superuser (for example in AWS RDS) | ||
-- GRANT prometheus TO :MASTER_USER; | ||
CREATE SCHEMA prometheus AUTHORIZATION prometheus; | ||
|
||
CREATE VIEW prometheus.pg_stat_activity | ||
AS | ||
SELECT * from pg_catalog.pg_stat_activity; | ||
|
||
GRANT SELECT ON prometheus.pg_stat_activity TO prometheus; | ||
|
||
CREATE VIEW prometheus.pg_stat_replication AS | ||
SELECT * from pg_catalog.pg_stat_replication; | ||
|
||
GRANT SELECT ON prometheus.pg_stat_replication TO prometheus; | ||
CREATE OR REPLACE FUNCTION __tmp_create_user() returns void as $$ | ||
BEGIN | ||
IF NOT EXISTS ( | ||
SELECT -- SELECT list can stay empty for this | ||
FROM pg_catalog.pg_user | ||
WHERE usename = 'postgres_exporter') THEN | ||
CREATE USER postgres_exporter; | ||
END IF; | ||
END; | ||
$$ language plpgsql; | ||
|
||
SELECT __tmp_create_user(); | ||
DROP FUNCTION __tmp_create_user(); | ||
|
||
ALTER USER postgres_exporter WITH PASSWORD '<set-a-password>'; | ||
ALTER USER postgres_exporter SET SEARCH_PATH TO postgres_exporter,pg_catalog; | ||
|
||
-- If deploying as non-superuser (for example in AWS RDS), uncomment the GRANT | ||
-- line below and replace <MASTER_USER> with your root user. | ||
-- GRANT postgres_exporter TO <MASTER_USER>; | ||
|
||
GRANT CONNECT ON DATABASE postgres TO postgres_exporter; | ||
``` | ||
|
||
### Firewall Ports | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters