pg-monz / pg_monz

This is the Zabbix monitoring template for PostgreSQL Database.
Apache License 2.0
164 stars 81 forks source link

pgsql_funcs.conf #13

Open santanab opened 9 years ago

santanab commented 9 years ago

I've installed pg_monz 2.0 with zabbix 2.4.5, for monitoring postgresql 9.3, I have more than one instance of postgresql on my server, one with port = 5432, other with port = 5433, and so on. But I don't know if I can configure more than one instance in pgsql_funcs.conf.

Something like that...

pghost= localhost pgport = 5432 ...

pghost = localhost pgport = 5433 ...

Another doubt with the zabbix user, I don't want to give him access trust (pg_hba.conf) but when I put the line of the password on my pgpass for use md5, still saying that password don't supplied, and I have to set trust on the file. I don't know if exist another way to deal with the password of the zabbix user, or if I have to put trust.

I wish some help with that, thanks.

y-mori0110 commented 9 years ago

Hi

But I don't know if I can configure more than one instance in pgsql_funcs.conf.

It's limitation for above two postgres on one host. Only you can define two host, attach the template to each host
and set {$PGSCRIPT_CONFDIR}, {$PGLOGDIR} .. to HOST MACRO.

I don't know if exist another way to deal with the password of the zabbix user, or if I have to put trust.

Using PGPASSFILE,you can do it.

1. define PGPASSFILE to pgsql_funcs.conf

PGHOST=localhost PGPORT=5432 PGROLE=postgres PGDATABASE=postgres

export PGPASSFILE=/usr/local/etc/pgpass

2.create pgpass file at /usr/local/etc/.

localhost:5432:*:postgres:somepassword

see also http://www.postgresql.org/docs/9.3/static/libpq-pgpass.html

santanab commented 9 years ago

Well, thanks, I will try that.

But, how can I configure two postgres on one host? Putting differents ports in pgsql_funcs.conf, as I mentioned before? Because I tried that yesterday, but It doesn't work, It was as if he was looking for the database that exist in the instance of the port 5432, in the instance of the port 5433, and said he could not find the database, logically because in that instance was not. Or there is another way to do that?

Also, I wish some help with this, I run zabbix_agentd -p on my zabbix agent, and that's part of his output.

Why that?

psql.running [t|sh: /pgsql_simple.sh: No such file or directory] psql.primary_server [t|sh: /pgsql_primary.sh: No such file or directory] psql.standby_server [t|sh: /pgsql_standby.sh: No such file or directory] pgsql.get.pg.transactions [t|sh: /pgsql_server_funcs.sh: No such file or directory] pgsql.get.pg.bgwriter [t|sh: /pgsql_server_funcs.sh: No such file or directory] pgsql.get.pg.slow_query [t|sh: /pgsql_server_funcs.sh: No such file or directory] pgsql.get.pg.stat_database [t|sh: /pgsql_db_funcs.sh: No such file or directory] pgsql.get.pg.size [t|sh: /pgsql_userdb_funcs.sh: No such file or directory]

And, again, thanks.

mijaresey commented 9 years ago

Good afternoon, I is presenting the following error, then place the .pgpass file and import it still gives me the following error 12207: 20150914: 182136,793 item "prueba_9.4:pgsql.get.pg.slow_query[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},{$PGSLOWQUERY_TIME_THRESHOLD}]" Became not supported: Received value [password for user postgres: psql: fe_sendauth: no password supplied] is not suitable for value type [Numeric (unsigned)] and data type [Decimal] 12205: 20150914: 182141,794 item "prueba_9.4:pgsql.get.pg.sr.status[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF}]" Became not supported: Received value [password for user postgres: psql: fe_sendauth: no password supplied] is not suitable for value type [Numeric (unsigned)] and data tt ype [Decimal] 12205: 20150914: 182141,794 item "prueba_9.4:pgsql.get.pg.transactions[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF}]" Became not supported: Received value [password for user postgres: psql: fe_sendauth: no password supplied] is not suitable for value type [Numeric (unsigned)] and datt to type [Decimal] 12206: 20150914: 182156,798 item "prueba_9.4: psql.primary_server [{$ PGSCRIPTDIR}, {$ PGSCRIPT_CONFDIR}]" Became not supported: Received value [Password for uu ser postgres: psql: fe_sendauth: no password supplied] is not suitable for value type [Numeric (unsigned)] and data type [Decimal] 12205: 20150914: 182206,799 item "prueba_9.4: psql.standby_server [{$ PGSCRIPTDIR}, {$ PGSCRIPT_CONFDIR}]" Became not supported: Received value [Password for uu ser postgres: psql: fe_sendauth: no password supplied] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

I'm using postgresql 9.4, they appreciate what I could to help. thank you

nikhilkorde commented 8 years ago

Hi I am also getting same issue . can you help to resolve. I have created pgpass file to pass password infor. but still same error. Apriciated your time.

PandaRoux8 commented 8 years ago

Your permission access have to be 600, on the password file. Is that ok ? I personnaly made a zabbix user for the database. Because my postgres user doesn't have any password.

nikhilkorde commented 8 years ago

Hi Thanks very much Now its working ..after this i am getting below error if you can help me to resolve will be appreciated your time.

em "tt:pgsql.get.pg.slow_query[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},{$PGSLOWQUERY_TIME_THRESHOLD}]" became not supported: Received value [/usr/local/bin/pgsql_server_funcs.sh: line 78: zabbix_sender: command not found] is not suitable for value type 1722:20160129:095317.354 item "tt:pgsql.get.pg.transactions[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF}]" became not supported: Received value [/usr/local/bin/pgsql_server_funcs.sh: line 78: zabbix_sender: command not found] is not suitable for value type 1721:20160129:095332.360 item "tt:psql.primary_server[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR}]" became not supported: Received value [psql: could not translate host name "-p" to address: Name or service not known] is not suitable for value type [ 1719:20160129:095427.416 item "tt:pgsql.get.pg.size[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},postgres]" became not supported: Received value [/usr/local/bin/pgsql_userdb_funcs.sh: line 40: zabbix_sender: command not found] is not suitable for value type 1719:20160129:095427.416 item "tt:pgsql.get.pg.size[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},test]" became not supported: Received value [/usr/local/bin/pgsql_userdb_funcs.sh: line 40: zabbix_sender: command not found] is not suitable for value type

PandaRoux8 commented 8 years ago

Download zabbix-sender. apt-get zabbix-sender

nikhilkorde commented 8 years ago

HI After installing zabb-sender on zabbix server as well at client. above not more. But next accrued .. Is there any configuration i missed.

2134:20160129:101422.669 enabling Zabbix agent checks on host "gg": host became available 2149:20160129:101547.394 item "gg:pgsql.get.pg.slow_query[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},{$PGSLOWQUERY_TIME_THRESHOLD}]" became not supported: Received value [Sending failed. Use option -vv for more detailed output] is not suitable for value type [Numeric (unsigned)] and 2149:20160129:101547.394 item "gg:pgsql.get.pg.transactions[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF}]" became not supported: Received value [Sending failed. Use option -vv for more detailed output] is not suitable for value type [Numeric (unsigned)] and 2150:20160129:101602.402 item "gg:psql.primary_server[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR}]" became not supported: Received value [psql: could not translate host name "-p" to address: Name or service not known] is not suitable for value type [

PandaRoux8 commented 8 years ago

Is the ServerActive line complete on your zabbix-agent.conf ?

nikhilkorde commented 8 years ago

Yes
ServerActive=127.0.0.1 is this?

PandaRoux8 commented 8 years ago

You're trying to monitor postgres on your zabbix server ? Try to modify like this : ServerActive=127.0.0.1:10051

Where 10051 is the active port of your zabbix server (10051 is the default one)

Also, if that doesnt work try to run this command :

zabbix_sender -c -T -o 11 -k pgsql.get.pg.stat_database -vv

nikhilkorde commented 8 years ago

I am trying to monitor postgres database at client server> I modifyed serverActive=127.0.0.1:10051 as you mention but still issue perssist.

I performed below command and got his output.

root@puppet:/usr/local/bin# zabbix_sender -c -T -o 11 -k pgsql.get.pg.stat_database -vv zabbix_sender [10592]: cannot open config file [-T]: [2] No such file or directory

PandaRoux8 commented 8 years ago

Like this sorry : zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -T -o 11 -k pgsql.get.pg.stat_database -vv

where /etc/zabbix... is your path to the zabbix-agent conf on your host.

And in the serverActive you have to put the IP adress or name of your zabbix server.

for example -> serverActive=Zabbix-server:10051

nikhilkorde commented 8 years ago

1) I have added zabbix server ip in etc/zabbix/zabbix_agentd.conf on client serverActive=Zabbix-server:10051

2) performed below command got out put.

root@puppet:/usr/local/bin# zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -T -o 11 -k pgsql.get.pg.stat_database -vv zabbix_sender [11549]: DEBUG: answer [{ "response":"success", "info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000026"}] info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000026" sent: 1; skipped: 0; total: 1 root@puppet:/usr/local/bin#

3) Below information found in log file triggerd in zabbix server log

2528:20160129:110704.171 cannot send list of active checks to [10.0.0.222]: host [Zabbix server] not monitored 2539:20160129:110733.051 item "yy:pgsql.get.pg.slow_query[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},{$PGSLOWQUERY_TIME_THRESHOLD}]" became supported 2539:20160129:110733.051 item "yy:pgsql.get.pg.transactions[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF}]" became supported 2532:20160129:110904.208 cannot send list of active checks to [10.0.0.222]: host [Zabbix server] not monitored 2539:20160129:110923.099 item "ii:pgsql.get.pg.slow_query[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},{$PGSLOWQUERY_TIME_THRESHOLD}]" became supported 2539:20160129:110923.099 item "ii:pgsql.get.pg.transactions[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF}]" became supported 2539:20160129:111033.136 item "yy:pgsql.get.pg.size[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},postgres]" became supported 2539:20160129:111033.136 item "yy:pgsql.get.pg.size[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},test]" became supported 2530:20160129:111104.248 cannot send list of active checks to [10.0.0.222]: host [Zabbix server] not monitored 2541:20160129:111113.154 item "ii:pgsql.get.pg.size[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},postgres]" became supported 2541:20160129:111113.154 item "ii:pgsql.get.pg.size[{$PGSCRIPTDIR},{$PGSCRIPT_CONFDIR},{HOST.HOST},{$ZABBIX_AGENTD_CONF},test]" became supported

4) This error found inn zabbix server log

2532:20160129:111304.291 cannot send list of active checks to [10.0.0.222]: host [Zabbix server] not monitored

PandaRoux8 commented 8 years ago

There is probably a problem in your zabbix configuration. If you have any question about the zabbix-sender or the postgres monitoring feel free to ask, but you have to find out how zabbix work, in order to do the good configuration.

(Server and ServerActive must match the hostname of your zabbix server on frontend. Also your hostname on agent have to match the hostname on frontend)

PS : Don't forget to restart your zabbix-agent everytime you change the config.

nikhilkorde commented 8 years ago

Hi Thanks alot for your help. there is issue with host name and resolved now,

PostgreSQL monitoring successfully Now.

Thanks for your help and valuable time... keep in touch.

sirsosnet commented 8 years ago

Hi,

If I run this command "zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -T -o 11 -k pgsql.get.pg.stat_database -vv" I get this output

zabbix_sender [31618]: too few or mutually exclusive options used usage: zabbix_sender [-v] -z server [-p port] [-I IP-address] -s host -k key -o value zabbix_sender [-v] -z server [-p port] [-I IP-address] [-s host] [-T] [-r] -i input-file ..........

What am I missing? Please help

PandaRoux8 commented 8 years ago

Does your host is working on Zabbix ? I mean, your conf file has to be correct, also you need to have the ServerActive part configured in order to make the zabbix_sender work.

sirsosnet commented 8 years ago

I have been monitoring the linux box on zabbix.

We have decided to migrate from mysql to postgres.

These are the only changes made in the zabbix_agentd.conf ServerActive=192.168.2.20:10051 Hostname=jiradev01

On the zabbix server it shows all databases on the postgres server but they is no data showing.

PandaRoux8 commented 8 years ago

I'm not sure, it's been a while I did not work on Zabbix. But if I remember correctly, the zabbix host on which you want to monitor postgres has to be configured in active AND passive. And yours seem to be only configured for active checks.

SergeBrick commented 6 years ago

Hello. I have same errors: Value "/usr/local/bin/pgsql_simple.sh: line 6: /usr/local/etc/pgsql_funcs.conf: Permission denied 0" of type "string" is not suitable for value type "Numeric (unsigned)"

SergeBrick commented 6 years ago

In etc/zabbix/zabbix_agentd.conf, Server=127.0.0.1, ServerActive=127.0.0.1. In zabbix web interface agent 127.0.0.1:10050.