LibreNMS - snmp extend check postgres: Difference between revisions

From Wiki.IT-Arts.net
imported>Z
(Created page with "Category:Post-It = check_postgres.pl = Get the script: <nowiki> wget https://github.com/bucardo/check_postgres/archive/master.zip</nowiki> Unzip and copy it where yo...")
 
imported>Z
No edit summary
Line 58: Line 58:




= Check command =
= Check Command =


Adapt the user and path to your configuration:
Adapt the user and path to your configuration:

Revision as of 10:53, 1 May 2020



check_postgres.pl

Get the script:

wget https://github.com/bucardo/check_postgres/archive/master.zip

Unzip and copy it where you need. Make it executable.


LibreNMS script

wget https://github.com/librenms/librenms-agent/raw/master/snmp/postgres -O /etc/snmp/postgres

In case of bug on the user/service, adapt $cpg --dbservice=$DBuser --action dbstats | awk -F ' ' \'

Verify the path to check_postgres.pl in /etc/snmp/postgres is correct.


pg_service

Modify/create and adapt to your configuration /etc/postgresql-common/pg_service.conf:

[yourServiceName]
host=127.0.0.1
port=5432
user=your_adapted_user
password=your_password
dbname=your_db_name
sslmode=require

Restart the service.


.pgpass

The file .pgpass in a user's home directory or the file referenced by PGPASSFILE can contain passwords to be used if the connection requires a password (and no password has been specified otherwise).

This file should contain lines of the following format:

hostname:port:database:username:password

SNMP Configuration

Adapt your /etc/snmp/snmpd.conf with:

extend postgres /etc/snmp/postgres

Restart the service.


Check Command

Adapt the user and path to your configuration:

sudo -u Debian-snmp /etc/snmp/postgres


Sources