Code Monkey home page Code Monkey logo

Comments (20)

cavaliercoder avatar cavaliercoder commented on June 12, 2024

Can you retrieve PG keys from the agent using zabbix_get??? E.g.

$ zabbix_get -s 127.0.0.1 -k pg.modver

from libzbxpgsql.

korkoda avatar korkoda commented on June 12, 2024

No. I'm getting error message:
zabbix_get [28256]: Check access restrictions in Zabbix agent configuration

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

If zabbix_agentd -p is printing out PostgreSQL keys then the module has loaded successfully. Please make sure you go through the Zabbix and libzbxpgsql documentation in detail to make sure you haven't missed anything.

Some things to check:

  • You are using the correct module version for Zabbix 2 or 3
  • The zabbix server IP is listed in Server and ServerActive in the agent configuration (also add 127.0.0.1 to get rid of the access restrictions error)
  • zabbix_get -s <agent_ip> -k pg.modver works when called from the Zabbix server to the Zabbix agent
  • You allow enough time for the agent to refresh its configuration from the server (or restart the agent)
  • other active items are collecting data (not just simple items)

from libzbxpgsql.

korkoda avatar korkoda commented on June 12, 2024

Besides libzxpsql which I'm specially intrested in all is running flawlessly on my Zabbix.
One thin I just realized which may be important here. I did install libzxpsql from source on my Ubuntu 12.04 because there was no dedicated deb files for my Ubuntu precise. I don't think this might be the problem here but maybe it does?

from libzbxpgsql.

korkoda avatar korkoda commented on June 12, 2024

Did check your list:

  • I did download and install libzxpsql for Zabbix 3. Same as version as Zabbix Agent and Server.
  • Server and ServerActive pointing right Server's IP - all other data are collected by agent without issues.

    also add 127.0.0.1 to get rid of the access restrictions error
    I've added 127.0.0.1 but I'm still receiving:
    zabbix_get [18533]: Check access restrictions in Zabbix agent configuration

  • zabbix_get -s won't work when called from Server because monitored machine is behind firewall. I'm using only active checks there.

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

Which version of Zabbix is the agent? If it's v3 and you compile libzbxpgsql from source, you need to replace the header files in include/ with the headers from Zabbix v3 source code as per #34.

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

You said zabbix_get -s won't work because the agent is behind a firewall. zabbix_get uses the same port and protocol as the Zabbix server. In this case, how can your server reach the agent? Basically, if zabbix_get won't work from the server, I can guarantee the server won't work either.

from libzbxpgsql.

korkoda avatar korkoda commented on June 12, 2024

Zabbix Agent is v3. I did compiled it now with include folder from Zabbix source as you suggested. No change though.
Till now thought that Agent with libzxpgsql will ba able to collect and send data using active checks. Can't it be done that way?
I did install postgres on Zabbix server for testing. Repeated same install procedure. Module is loading successfully and zabbix_get -s 127.0.0.1 -k pg.modver returns module version corectly. But the only data collected in template is PostgreSQL Server responding with value 0.

Don't know what I'm doing wrong :/

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

Yes, the template should use active checks but communication should work in both directions; for passive and active checks. Perhaps your firewall is blocking active checks? Have you tried this in a hermetic environment without the firewall, etc.?

If PostgreSQL Server responding is returning 0, that means that the Zabbix server is successfully communicating with the agent and module. Otherwise, their would be no data.

The most likely scenario here is that your connection string or pg_hba.conf access list is incorrect. Please check the PostgreSQL and Zabbix agent log files to determine why the connection is failing.

Please also, double check you have followed all of the instructions in the documentation at http://cavaliercoder.com/libzbxpgsql/agent-keys/.

from libzbxpgsql.

korkoda avatar korkoda commented on June 12, 2024

Ok. Working with agent without FW now.
Added to pg_hba.conf:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             zabbix                                  trust

Added to postgres:

CREATE ROLE zabbix WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE;
GRANT CONNECT ON DATABASE postgres TO zabbix;

And in the logs I see:
zabbix:
Failed to connect to PostgreSQL in pg_connect(): fe_sendauth: no password supplied
posgtres:
zabbix@postgres LOG: could not receive data from client: Connection reset by peer

Why he needs pasword when in pg_hba.conf is set to trust?
BTW I'm able to connect with psql -U zabbix.

from libzbxpgsql.

korkoda avatar korkoda commented on June 12, 2024

It works now. I had to change pg_hba.conf to:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host   all             zabbix             127.0.0.1/32             trust

Thanks for help.

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

So I think the root cause here is that your connection string was using the localhost IP address which wasn't trusted in your HBA.

All the tests we tried like zabbix_agentd -p use the default connection string which uses Unix sockets instead of TCP/IP. I'd probably recommend you do this, instead of TCP/IP.

Please note everything you have tested and tried is already covered in the libzbxpgsql documentation linked above.

from libzbxpgsql.

kedare avatar kedare commented on June 12, 2024

I have a similar problem.

I can get without any issue from the zabbix server the informations from the agent using the same data than on the macro, example :

# zabbix_get -s {Server IP} -k pg.backends.count[dbname=localhost,xxxx]

4

But no way to see anything appear in the Zabbix web interface, when I go to last data I can see the metric keys but no data.
Everything is enabled on the host, I have no idea of why it's not working :/
I don't have any other active checks on the whole system and it's the first time I use them, is there something specific to enable on the Zabbix server ?
(EDIT: Hmm when going to the queue page on the interface I see that the active checks are all on queue... Not sure if it's related ?)

When checking the logs of the agent in verbose mode I can see that it's doing queries only when I use the zabbix_get :

 27084:20160806:232121.046 Requested [pg.db.xid_age[dbname=localhost,xxx]]
 27084:20160806:232121.046 In pg_get_result(pg.db.xid_age)
 27084:20160806:232121.046 In pg_scalar
 27084:20160806:232121.046 In pg_connect()
 27084:20160806:232121.059 End of pg_connect()
 27084:20160806:232121.059 Executing query with 0 parameters: SELECT MAX(AGE(datfrozenxid)) FROM pg_database;
 27084:20160806:232121.063 End of pg_scalar
 27084:20160806:232121.063 End of pg_get_result(pg.db.xid_age)

It's like if the server was not sending any query

from libzbxpgsql.

syswipe avatar syswipe commented on June 12, 2024

Hi! i have exactly the same issue like kedare.
zabbix_get works perfectly but there are no data in Zabbix interface.

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

The verbose agent logs should show where the agent is refreshing its configuration from the server. It does this once an hour or so. In this log entry, you should see all of the items the server is telling the agent to actively monitor in JSON format. Are the expected PG items listed there?

Also, are the logs on the server showing any issues?

from libzbxpgsql.

Abdull avatar Abdull commented on June 12, 2024

My environment:

  • libzbxpgsql 1.1.0
  • zabbix_agentd (daemon) (Zabbix) 3.2.4
  • zabbix_server (Zabbix) 3.2.4

I have the same problems as @kedare. zabbix_get works:

$ zabbix_get -s localhost -k pg.backends.count[,postgres]
8

So I can query for values on the command line. But these values don't show up with in the Zabbix Server HTML interface. Instead I see e.g. [no data] on the PostgreSQL Backend Connections graph.

With an increased agent debug logging level, I see the following messages on agent startup:

using module configuration file: /etc/zabbix/libzbxpgsql.conf
cannot find "zbx_module_history_write_cbs()" function in module "libzbxpgsql.so": /usr/lib/zabbix/modules/libzbxpgsql.so: undefined symbol: zbx_module_history_write_cbs
loaded modules: libzbxpgsql.so

from libzbxpgsql.

alexspeter avatar alexspeter commented on June 12, 2024

I have the same problems zabbix_get works, but "last data" and triggers zabbix no data.

libzbxpgsql 1.1.0
zabbix_agentd (daemon) (Zabbix) 3.2.6
zabbix_server (Zabbix) 3.2.4

Testing command zabbix_agentd -p | grep '^pg\.' and shows all right

[root@pg1 ~]# zabbix_get -s 127.0.0.1 -k pg.modver
libzbxpgsql 1.1.0, compiled for Zabbix 3.2.3

Above logs zabbix agent (level 5) get infos with below command (another templates Oracle, ... disable)
29984:20170722:145817.867 In update_cpustats()
29984:20170722:145817.867 End of update_cpustats()
29984:20170722:145817.867 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]'
29986:20170722:145818.727 __zbx_zbx_setproctitle() title:'listener #2 [processing request]'
29986:20170722:145818.727 Requested [pg.modver]
29986:20170722:145818.727 In MODVER
29986:20170722:145818.727 End of MODVER
29986:20170722:145818.728 Sending back [libzbxpgsql 1.1.0, compiled for Zabbix 3.2.3]
29986:20170722:145818.728 __zbx_zbx_setproctitle() title:'listener #2 [waiting for connection]'
29984:20170722:145818.867 __zbx_zbx_setproctitle() title:'collector [processing data]'
29984:20170722:145818.867 In update_cpustats()
29984:20170722:145818.867 End of update_cpustats()
29984:20170722:145818.867 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]'
29984:20170722:145819.868 __zbx_zbx_setproctitle() title:'collector [processing data]'
29984:20170722:145819.868 In update_cpustats()
29984:20170722:145819.868 End of update_cpustats()
29984:20170722:145819.868 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]'
^C

from libzbxpgsql.

alexspeter avatar alexspeter commented on June 12, 2024

Owww yes, I found same error

2671:20170722:160340.628 In zbx_dshm_destroy() shmid:-1
2671:20170722:160340.628 End of zbx_dshm_destroy():SUCCEED
2671:20170722:160340.628 In zbx_unload_modules()
2671:20170722:160340.628 End of zbx_unload_modules()
2671:20170722:160340.628 Zabbix Agent stopped. Zabbix 3.2.6 (revision 67849).
4112:20170722:160340.702 Starting Zabbix Agent [ora1.localdomain]. Zabbix 3.2.6
(revision 67849).
4112:20170722:160340.703 **** Enabled features ****
4112:20170722:160340.703 IPv6 support: YES
4112:20170722:160340.703 TLS support: YES
4112:20170722:160340.703 **************************
4112:20170722:160340.703 using configuration file: /etc/zabbix/zabbix_agentd.con
f
4112:20170722:160340.703 In zbx_load_modules()
4112:20170722:160340.703 loading module "/usr/lib64/zabbix/modules/libzbxpgsql.s
o"
4112:20170722:160340.708 starting agent module libzbxpgsql 1.1.0
4112:20170722:160340.708 using module configuration file: /etc/zabbix/libzbxpgsq
l.conf
4112:20170722:160340.709 cannot find "zbx_module_history_write_cbs()" function i
n module "libzbxpgsql.so": /usr/lib64/zabbix/modules/libzbxpgsql.so: undefined sym
bol: zbx_module_history_write_cbs
4112:20170722:160340.709 loaded modules: libzbxpgsql.so
4112:20170722:160340.709 End of zbx_load_modules():SUCCEED
4112:20170722:160340.709 In init_collector_data()
4112:20170722:160340.709 In zbx_dshm_create() proj_id:112 size:0
4112:20170722:160340.709 End of zbx_dshm_create():SUCCEED shmid:-1
4112:20170722:160340.709 End of init_collector_data()
4112:20170722:160340.710 agent #0 started [main process]
4113:20170722:160340.710 agent #1 started [collector]
4113:20170722:160340.710 In init_cpu_collector()
4113:20170722:160340.710 End of init_cpu_collector():SUCCEED
4113:20170722:160340.710 __zbx_zbx_setproctitle() title:'collector [processing d
ata]'

from libzbxpgsql.

alexspeter avatar alexspeter commented on June 12, 2024

update My environment:

libzbxpgsql 1.1.0
zabbix_agentd (daemon) (Zabbix) 3.2.7
zabbix_server (Zabbix) 3.2.7
I have the same problems as @kedare.

zabbix_get works!
Testing command zabbix_agentd -p | grep '^pg.' and shows all right
[root@pg1 ]# zabbix_get -s 127.0.0.1 -k pg.modver
libzbxpgsql 1.1.0, compiled for Zabbix 3.2.3
[root@pg1 ]# zabbix_get -s 127.0.0.1 -k pg.version
PostgreSQL 9.2.18 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit

with an increased agent debug logging level, I see the following messages on agent startup:
using module configuration file: /etc/zabbix/libzbxpgsql.conf
cannot find "zbx_module_history_write_cbs()" function in module "libzbxpgsql.so": /usr/lib/zabbix/modules/libzbxpgsql.so: undefined symbol: zbx_module_history_write_cbs
loaded modules: libzbxpgsql.so

und template don't work, none "Lastest data" ...

{$PG_CONN} host=localhost port=5432 user=postgres connect_timeout=10
{$PG_DB} postgres

from libzbxpgsql.

amatolf avatar amatolf commented on June 12, 2024

I´m facing same problem, any clues?

from libzbxpgsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.