Commit b70bac21 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

User parameters for zabbix agent now live in separate file - /etc/zabbix_agentd.userparams.conf

parent 62728f3a
......@@ -38,30 +38,31 @@ all: postgresql-service
sed -i "s/^#listen_addresses = .*/listen_addresses = '*'/" /srv/pgsql/data/postgresql.conf
sed -i "s/^#password_encryption = .*/password_encryption = scram-sha-256/" /srv/pgsql/data/postgresql.conf
echo "host all all 0.0.0.0/0 scram-sha-256" >> /srv/pgsql/data/pg_hba.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.replication.status[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.status.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.replication.lag.sec[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.lag.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.replication.recovery_role[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.recovery_role.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.replication.count[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -c "SELECT count(*) FROM pg_stat_replication"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.version[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -c "SELECT version();"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.ping.time[*], LANG=C.UTF-8 psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.ping[*], pg_isready -h "$$1" -p "$$2"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.db.size[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -c "SELECT pg_database_size('$$6')"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.discovery.db[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.discovery.db.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.frozenxid[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.frozenxid.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.scans[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.scans.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.cache.hit[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.cache.hit.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.uptime[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.uptime.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.queries[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -v tmax=$$6 -f "/var/lib/zabbix/postgresql/pgsql.query.time.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.locks[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.locks.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.wal.stat[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.wal.stat.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.config.hash[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.config.hash.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.transactions[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.transactions.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.dbstat[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.dbstat.sum[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sum.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.connections.prepared[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.prepared.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.connections[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.connections.sum[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.sum.sql"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=pgsql.bgwriter[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.bgwriter.sql"' -i /etc/zabbix_agentd.conf
echo 'UserParameter=device.id,/usr/sbin/deviceid' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.replication.status[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.status.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.replication.lag.sec[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.lag.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.replication.recovery_role[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.recovery_role.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.replication.count[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -c "SELECT count(*) FROM pg_stat_replication"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.version[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -c "SELECT version();"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.ping.time[*], LANG=C.UTF-8 psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.ping[*], pg_isready -h "$$1" -p "$$2"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.db.size[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -c "SELECT pg_database_size('$$6')"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.discovery.db[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.discovery.db.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.frozenxid[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.frozenxid.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.scans[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.scans.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.cache.hit[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.cache.hit.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.uptime[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.uptime.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.queries[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -v tmax=$$6 -f "/var/lib/zabbix/postgresql/pgsql.query.time.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.locks[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.locks.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.wal.stat[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.wal.stat.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.config.hash[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.config.hash.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.transactions[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.transactions.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.dbstat[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.dbstat.sum[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sum.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.connections.prepared[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.prepared.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.connections[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.connections.sum[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.sum.sql"' >> /etc/zabbix_agentd.userparams.conf
echo 'UserParameter=pgsql.bgwriter[*], psql -qtAX postgresql://"$$3":"$$4"@"$$1":"$$2"/"$$5" -f "/var/lib/zabbix/postgresql/pgsql.bgwriter.sql"' >> /etc/zabbix_agentd.userparams.conf
@echo "d /run/postgresql 0775 postgres postgres -" > /usr/lib/tmpfiles.d/postgresql.conf
@echo "$$POSTGRESQL_SERVICE" > /lib/systemd/system/postgresql.service
systemctl enable postgresql.service
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment