ZABBIX Forums  
  #1  
Old 22-04-2012, 09:06
k0k k0k is offline
Junior Member
 
Join Date: Apr 2012
Posts: 8
Default PostgreSQL Zabbix Template

Template to keep monitored PostgreSQL Enterprises Databases, some features monitored are: connection pool, buffers, locks, checkpoints, performance and availability, displays graphics statistics, this work is inspired in Postbix of SmartMarmot Tech.

You just need to put the script: 'db-pgstat.pl' on the databases servers in a executable search path and add 'UserParamenter' in zabbix_agentd.conf:

UserParameter=postgres.activeconn,db-pgstat.pl --user postgres --database DATABASE --activeconn
UserParameter=postgres.tupreturned,db-pgstat.pl --user postgres --database DATABASE --tupreturned
UserParameter=postgres.tupfetched,db-pgstat.pl --user postgres --database DATABASE --tupfetched
UserParameter=postgres.tupinserted,db-pgstat.pl --user postgres --database DATABASE --tupinserted
UserParameter=postgres.tupupdated,db-pgstat.pl --user postgres --database DATABASE --tupupdated
UserParameter=postgres.tupdeleted,db-pgstat.pl --user postgres --database DATABASE --tupdeleted
UserParameter=postgres.xactcommit,db-pgstat.pl --user postgres --database DATABASE --xactcommit
UserParameter=postgres.xactrollback,db-pgstat.pl --user postgres --database DATABASE --xactrollback
UserParameter=postgres.exclusivelock,db-pgstat.pl --user postgres --database DATABASE --exclusivelock
UserParameter=postgres.accessexclusivelock,db-pgstat.pl --user postgres --database DATABASE --accessexclusivelock
UserParameter=postgres.accesssharelock,db-pgstat.pl --user postgres --database DATABASE --accesssharelock
UserParameter=postgres.rowsharelock,db-pgstat.pl --user postgres --database DATABASE --rowsharelock
UserParameter=postgres.rowexclusivelock,db-pgstat.pl --user postgres --database DATABASE --rowexclusivelock
UserParameter=postgres.shareupdateexclusivelock,db-pgstat.pl --user postgres --database DATABASE --shareupdateexclusivelock
UserParameter=postgres.sharerowexclusivelock,db-pgstat.pl --user postgres --database DATABASE --sharerowexclusivelock
UserParameter=postgres.checkpoints_timed,db-pgstat.pl --user postgres --database DATABASE --checkpoints_timed
UserParameter=postgres.checkpoints_req,db-pgstat.pl --user postgres --database DATABASE --checkpoints_req
UserParameter=postgres.buffers_checkpoint,db-pgstat.pl --user postgres --database DATABASE --buffers_checkpoint
UserParameter=postgres.buffers_clean,db-pgstat.pl --user postgres --database DATABASE --buffers_clean
UserParameter=postgres.maxwritten_clean,db-pgstat.pl --user postgres --database DATABASE --maxwritten_clean
UserParameter=postgres.buffers_backend,db-pgstat.pl --user postgres --database DATABASE --buffers_backend
UserParameter=postgres.buffers_alloc,db-pgstat.pl --user postgres --database DATABASE --buffers_alloc

You can use --pass option for password database support. (not recommend)

Finally this template and perl file was tested for Zabbix 1.8.10, postgreSQL 8.4+ and RHEL 5.5, this obviously is Open Source and you can report bugs to Wilmer Jaramillo M. wilmer_at_fedoraproject.org.
Attached Files
File Type: zip zbx_postgresql_template.zip (3.7 KB, 954 views)

Last edited by k0k; 23-04-2012 at 15:52. Reason: Fixed proc.mem parameter in template
Reply With Quote
  #2  
Old 31-05-2012, 15:20
frlan frlan is offline
Junior Member
 
Join Date: May 2012
Posts: 18
Default

Somehow I'm missing the point how to make a item from it.
Reply With Quote
  #3  
Old 31-07-2012, 01:21
viper233 viper233 is offline
Junior Member
 
Join Date: Jul 2012
Location: Vancouver
Posts: 1
Default

I'm also having issues with this script values being returned as text and not unsigned integers. Zabbix server ignores most of the data because it is of the wrong type.
Reply With Quote
  #4  
Old 31-07-2012, 15:38
k0k k0k is offline
Junior Member
 
Join Date: Apr 2012
Posts: 8
Default

Please try with next files: https://github.com/k0k/Zabbix/blob/m...PostgreSQL.xml
https://github.com/k0k/Zabbix/blob/master/db-pgstat.pl

Remember, this template is not yet tested with Zabbix 2.0, sorry.
Reply With Quote
  #5  
Old 08-03-2013, 17:29
CeeEss CeeEss is offline
Member
Zabbix Certified Specialist
 
Join Date: Nov 2007
Location: London, UK
Posts: 97
Default

This is great - thanks very much!
Reply With Quote
  #6  
Old 08-03-2013, 19:02
k0k k0k is offline
Junior Member
 
Join Date: Apr 2012
Posts: 8
Thumbs up

You're welcome.
Reply With Quote
  #7  
Old 17-05-2013, 13:14
thysk thysk is offline
Junior Member
 
Join Date: May 2013
Posts: 16
Default

Hi k0k

Thanks for this nice temple I have just imported it and want to roll out to my servers but I don't see the script for the pgsql items (postgres items are working 100%), could you possibly publish it ?

Thanks again
Thys
Reply With Quote
  #8  
Old 17-05-2013, 13:49
thysk thysk is offline
Junior Member
 
Join Date: May 2013
Posts: 16
Default

Please ignore my last post, I made a mistake with my template import
Reply With Quote
  #9  
Old 04-11-2013, 19:16
JayC JayC is offline
Junior Member
 
Join Date: Nov 2013
Location: Switzerland
Posts: 5
Default

Quote:
Originally Posted by viper233 View Post
I'm also having issues with this script values being returned as text and not unsigned integers. Zabbix server ignores most of the data because it is of the wrong type.
Hi k0k,

I second this. Am trying to get this running on zabbix 2.0.9, wheezy and perl 5.14.2 to query postgresql 9.2 and 9.3 instances.

I've tested all queries manually and the script itself is running great but as viper233 stated results are returned as text strings.

I'm no coder but maybe you can help me out there. I need to replace the "GetOptions()" statements
Code:
'size'          => sub { print query_database($querys{size}) },
so that they output unsigned decimals.

Any idea? Have tested numerous option with printf instead of print but really can't get it to roll.

Many thanks in advance,
JS
Reply With Quote
Reply

Tags
database, perl, postgresql, rdbms

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:10.