PostgreSQL Host Template

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

pesticles
Posts: 1
Joined: Thu Feb 02, 2012 7:59 pm

Re: PostgreSQL Host Template

Post by pesticles »

ejortegau wrote:I realize this is an oooooold thread, but I was wondering whether anyone knows if the template still works. Particularly, on cacti 0.8.7g
I've just successfully installed this template on Debian Squeeze with Cacti 0.8.7g, monitoring a PostgresQL 9.0 database.

I made some changes to the graph templates and edited the pgsql_stats.php script as I'm using a non-standard port, I may post up an update if _Dmitry_ doesn't mind.

Luke.
jelesp
Posts: 1
Joined: Tue Feb 07, 2012 6:25 am

Re: PostgreSQL Host Template

Post by jelesp »

Please update post, Dmitry's template is not working for me :(
ddk
Posts: 5
Joined: Wed Jul 07, 2010 1:06 am

Re: PostgreSQL Host Template

Post by ddk »

I've just installed this template on cacti 0.8.7i
But I can't understand where to input login|password for db connect?
When I'm running data query, I had:

Code: Select all

+ Running data query [11].
+ Found type = '4' [Script Query].
+ Found data query XML file at '<path>/cacti/resource/script_queries/postgres_dbstat.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting arg_index entries
+ Executing script for list of indexes '/usr/bin/php <path>/cacti/scripts/pgsql_stats.php 192.168.0.239 index' Index Count: 0
+ Executing script query '/usr/bin/php <path>/cacti/scripts/pgsql_stats.php 192.168.0.239 query dbname'
if run script I got an error:

Code: Select all

# php -q pgsql_stats.php index 192.168.0.239 user password
ERROR
^ because syntax is wrong, right syntax is:

Code: Select all

php -q pgsql_stats.php 192.168.0.239 index
there is a mistake in help line #260.

But I can connect to database with same login|password via psql.

I did not have enough patience :)
After changing the username/password on lines 197/198 it worked.
chrischris
Posts: 1
Joined: Tue Jul 17, 2012 5:23 am

Re: PostgreSQL Host Template

Post by chrischris »

Hi,

is it possible to run the script with different ports, dbnames on multiple servers?
Or just to import the script twice?
Shivaramakrishnan
Posts: 22
Joined: Tue Feb 26, 2013 3:37 pm

Re: PostgreSQL Host Template

Post by Shivaramakrishnan »

_Dmitry_
Can you send me the xml files and host templates ?I am interested in it.
WildChildX
Posts: 1
Joined: Wed Mar 06, 2013 10:19 am

Re: PostgreSQL Host Template

Post by WildChildX »

Hi, im using Version 0.8.8a of cacti. I have checked the remote connections to the databse and imported all of the files but i got the following error on the data query:

Code: Select all

Data Query Debug Information
+ Running data query [11].
+ Found type = '4' [Script Query].
+ Found data query XML file at '/usr/share/cacti/resource/script_queries/postgres_dbstat.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting arg_index entries
+ Executing script for list of indexes '/usr/bin/php /usr/share/cacti/scripts/pgsql_stats.php 10.20.12.100 index' Index Count: 1
+ Found index: Error: PostgreSQL connect failed. Check PostgreSQL parameters (10.20.12.100/username/password)
+ Executing script query '/usr/bin/php /usr/share/cacti/scripts/pgsql_stats.php 10.20.12.100 query dbname'
+ Found item [pg_DBName=' PostgreSQL connect failed. Check PostgreSQL parameters (10.20.12.100/username/password)'] index: Error
Also i have provided the username and password in the php file... Any ideas?
jimcjulsonjr
Posts: 48
Joined: Fri Dec 07, 2012 11:11 am

Re: PostgreSQL Host Template

Post by jimcjulsonjr »

WildChildX wrote:Hi, im using Version 0.8.8a of cacti. I have checked the remote connections to the databse and imported all of the files but i got the following error on the data query:

Code: Select all

Data Query Debug Information
+ Running data query [11].
+ Found type = '4' [Script Query].
+ Found data query XML file at '/usr/share/cacti/resource/script_queries/postgres_dbstat.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting arg_index entries
+ Executing script for list of indexes '/usr/bin/php /usr/share/cacti/scripts/pgsql_stats.php 10.20.12.100 index' Index Count: 1
+ Found index: Error: PostgreSQL connect failed. Check PostgreSQL parameters (10.20.12.100/username/password)
+ Executing script query '/usr/bin/php /usr/share/cacti/scripts/pgsql_stats.php 10.20.12.100 query dbname'
+ Found item [pg_DBName=' PostgreSQL connect failed. Check PostgreSQL parameters (10.20.12.100/username/password)'] index: Error
Also i have provided the username and password in the php file... Any ideas?
What lines did you edit in the pgsql_stats.php file to setup the Username/Password that you configured in your PGSQL instance? And also, did you confirm that the Username/Password that you did setup in PGSQL could execute the test queries that the OP outlined in his first post? Sorry if this is redundant, but I figured it was worth asking to make sure.
-------------------------------------

VERSION: Cacti 0.8.8b
POLLER: Spine
DATA SOURCES: 100,000K and Growing (Multiple Servers)
PLUGINS: AUTOM8, THOLD, DISCOVER, WEATHERMAP, BOOST, CLOG, NECTAR, MACTRACK, FLOWVIEW, SPIKEKILL, INTROPAGE, MONITOR
msn308590655
Posts: 1
Joined: Thu Jan 02, 2014 11:01 am

Re: PostgreSQL Host Template

Post by msn308590655 »

I import templates success, but also to properly connect to the database, but can not figure out。
when i add it will tips me need follow:
ostgreSQL - Rows Stats]
Index Type
Index Value
Output Type ID

and
RRDTool:
/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='TEST - PgSQL - DB Row' \
--base=1000 \
--height=200 \
--width=700 \
--alt-autoscale-max \
--lower-limit=1 \
--vertical-label='' \
--slope-mode \
--font TITLE:10: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/rra/17/627.rrd":n_tup_del:AVERAGE \
DEF:b="/var/www/html/rra/17/627.rrd":n_tup_ins:AVERAGE \
DEF:c="/var/www/html/rra/17/627.rrd":n_tup_upd:AVERAGE \
LINE1:a#FF0000FF:"Deleted" \
GPRINT:a:LAST:" Current\:%8.0lf" \
GPRINT:a:AVERAGE:"Average\:%8.0lf" \
GPRINT:a:MAX:"Maximum\:%8.0lf\n" \
LINE1:b#35962BFF:"Inserted" \
GPRINT:b:LAST:"Current\:%8.0lf" \
GPRINT:b:AVERAGE:"Average\:%8.0lf" \
GPRINT:b:MAX:"Maximum\:%8.0lf\n" \
LINE1:c#EA8F00FF:"Updated" \
GPRINT:c:LAST:" Current\:%8.0lf" \
GPRINT:c:AVERAGE:"Average\:%8.0lf" \
GPRINT:c:MAX:"Maximum\:%8.0lf\n"
RRDTool:
ERROR: opening '/var/www/html/rra/17/627.rrd': No such file or directory

I'm sure other monitoring is normal, except for postgresql。

i think it is postgresql 8.3 or higher doesn't have follow cause
stats_row_level = on
stats_reset_on_server_start = off
stats_block_level = on
stats_command_string = on
stats_start_collector = on
。Are there any other way to do it?
rgreiner
Posts: 4
Joined: Fri Mar 04, 2011 9:07 am

Re: PostgreSQL Host Template

Post by rgreiner »

Did someone manage to find out how to solve the problem reported by msn308590655? I'm running Cacti version 0.8.7g on a Debian 6 server, and after installing everything I ran into the same problem: Every graph ask for "Index Type", "Index Value" and "Output Type ID".

Any help would be appreciated.

Roberto
nago
Posts: 1
Joined: Fri Oct 17, 2014 2:53 am

Re: PostgreSQL Host Template

Post by nago »

Hi,

I modified these templates to work with check_postgres.pl perl script. To get it working you need to download the check_postgres.pl from http://bucardo.org/downloads/check_post ... 1.0.tar.gz

Then put that script to cacti's scripts folder and create a data input method. After that you can import the data templates and graph templates inside the attachment psqlstats.zip. This is the very first time I have done something in Cacti so I apologize if this is a bit complicated. Also my approach only supports one host since I dont know how to modify the data input method to support multiple hosts.

But yeah, at least it works. :)

Happy graphing!
Attachments
input_method.png
input_method.png (42.82 KiB) Viewed 6271 times
psqlstats.zip
(25.62 KiB) Downloaded 495 times
mikygee
Cacti User
Posts: 88
Joined: Thu Jul 30, 2009 3:13 am

Re: PostgreSQL Host Template

Post by mikygee »

Hello,
I'm not sure why the script is written in perl. Maybe php would have been better.
I mean, in some cases (web server chrooted) it's more convenient to use a language that is inside the chroot.
Anyway, is it the latest template to monitor postgresql ?
Thanks
Some info about my system
- Cacti: 0.8.8g / OpenBSD 6.6
- Third Party: Nginx 1.16.1 / PHP 7.3.10 / MariaDB 10.3.18v1 / NET-SNMP version 5.8p2 / RRDTool 1.7.2
- Plugins: Weathermap 0.97c / Settings 0.71 / Thold 0.5 / Flowview 1.1 / Realtime 0.5.2 / Predict 1.0
bheng
Posts: 2
Joined: Wed Aug 10, 2016 2:52 pm

Re: PostgreSQL Host Template

Post by bheng »

Where is postgresql.conf in a Mac OS ?
bheng
Posts: 2
Joined: Wed Aug 10, 2016 2:52 pm

Re: PostgreSQL Host Template

Post by bheng »

Can someone please post an instruction step-by-step on how to configure cacti with psql in stead of mysql ?
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests