Parameters
Parámetro | Descripción |
-d,--database | Database name (required) |
-u,--user | Name of the postgreSQL user(required) |
-p,-password | postgreSQL password (required) |
-i,--ip | server ip (required) |
--port | server port. Default 5432 (optional) |
--tentacle_port | Tentacle port (default 41121)(optional) |
--tentacle_address | Ip of the tentacle server to send the data (optional) |
--agent_name | To name the agent that will contain the custom queries modules, by default: "PostgreSQL" (optional). |
--prefix_module | To prefix the modules in case you want to differentiate them from other executions (optional). |
--conf | Path of the conf file with the queries (required) |
-g,--group | Pandora FMS target group (optional) |
--data_dir | Pandora FMS data directory. By default it is /var/spool/pandora/data_in/ (optional) |
--transfer_mode | XML transfer method, the two possible options are: tentacle or local. |
Pandora_postgresql.conf
In this file the queries that will create modules in PandoraFMS will be introduced.
The format to add the queries is the following:
name_module:query:type:description
* The description is not mandatory, if not entered it will remain empty.
Example:
number_connections:SELECT count(*) FROM pg_stat_activity;:generic_data:Number of Connections or running backend
connections_waiting_in_locks:SELECT count(*) FROM pg_stat_activity WHERE wait_event = 'Lock';:generic_data:Number of connections/backends waiting on locks
connections_idle_in_transaction:SELECT count(*) FROM pg_stat_activity WHERE wait_event = 'idle in transaction';:generic_data:Number of backends in a transaction, but are currently not doing anything and could be waiting for an input from the end user.
number_users:SELECT COUNT(usename) FROM pg_stat_activity;:generic_data:Number users conected in postgreSQL
number_roles:SELECT count(*) FROM pg_roles;:generic_data:A role can be thought of as either a database user, or a group of database users, depending on how the role is set up.
psql_version:SELECT version();:generic_data_string:PostgrSQL version
num_blocks:SELECT COUNT(*) FROM pg_locks;:generic_data:A high number of deadlocks indicates that there is a higher probability that two or more processes will attempt to access the same resource.
number_commits:SELECT sum(xact_commit) FROM (pg_database AS db JOIN pg_stat_database sdb ON db.datname=sdb.datname) WHERE db.datname = _database_;:generic_data:Number of commits the current transaction. All changes made by the transaction become visible to others and are guaranteed to be durable if a crash occurs.
number_rollbacks:SELECT sum(xact_rollback) FROM (pg_database AS db JOIN pg_stat_database sdb ON db.datname=sdb.datname) WHERE db.datname = _database_;:generic_data:This metric represents the number of times, per transaction during the sample period, that users manually issue the ROLLBACK statement or an error occurred during a user's transactions.
tuples_returned:SELECT sum(tup_returned) FROM (pg_database AS db JOIN pg_stat_database sdb ON db.datname=sdb.datname) WHERE db.datname = _database_;:generic_data:Number of rows returned by queries in this database
tuples_searched:SELECT sum(tup_fetched) FROM (pg_database AS db JOIN pg_stat_database sdb ON db.datname=sdb.datname )WHERE db.datname = _database_;:generic_data:Number of tuples searched
tuples_inserted:SELECT sum(tup_inserted) FROM (pg_database AS db JOIN pg_stat_database sdb ON db.datname=sdb.datname) WHERE db.datname = _database_;:generic_data:Number of rows inserted into table
tuples_updated:SELECT sum(tup_updated) FROM (pg_database AS db JOIN pg_stat_database sdb ON db.datname=sdb.datname) WHERE db.datname = _database_;:generic_data:Number of tuples updated
tuples_removed:SELECT sum(tup_deleted) FROM (pg_database AS db JOIN pg_stat_database sdb ON db.datname=sdb.datname) WHERE db.datname = _database_;:generic_data:Number of tuples removed
state:SELECT state FROM pg_stat_activity WHERE datname = _database_;:generic_data_string:Database status
number_databases_list:select * from pg_database;:generic_data_string