lesovsky / zabbix-extensions

Zabbix additional monitoring modules
BSD 3-Clause "New" or "Revised" License
316 stars 230 forks source link

PostgreSQL service not running on Zabbix server #80

Closed dmjaya closed 4 years ago

dmjaya commented 4 years ago

Hi. I have a issue when monitoring postgres 12 DB in zabbix 4.4. please refer the below image could you please check why this happens.

image

Thanks,

stephankn commented 4 years ago

The "PostgreSQL service not running on {HOSTNAME}" will trigger on this expression:

<expression>{Template DB PostgreSQL:proc.num[{$PG_PROCESS_NAME}].last()}=0</expression>

The item "proc.num" is filled by your Zabbix Agent.

My guess is that you either have PostgreSQL not running or it uses a different process name in your setup than postgrs.

<macro>
    <macro>{$PG_PROCESS_NAME}</macro>
    <value>postgres</value>
</macro>

Please give more details about your environment, especially what process name you are using for PostgreSQL.

dmjaya commented 4 years ago

Thanks a lot for the information, may I know how to find the Postgres running process name in centos.

stephankn commented 4 years ago

I am not using CentOS. By looking on the rpm packages provided by postgresql, I would have guessed on postgres, as it is in the package by this name. But then it is surprising that it is not available on your installation.

Please double check which version of the OS you are using. Is it properly installed and available in the path?

Is this folder present on your system?

/usr/pgsql-12/bin/
dmjaya commented 4 years ago

Thanks for valuable information, I'm using "CentOS Linux release 7.7.1908 (Core)" and /usr/pgsql-12/bin/ path is available. Please refer to the macro value on the UI side.

image

And my Postgres database service is Up and running.

image

Many Thanks.

stephankn commented 4 years ago

Did you modify the macro PG_PROCESS_NAME? In the original template is defaults to postgres. This is the correct name used in Ubuntu and according to the official documentation the right one.

The postmaster process is an deprecated alias:

https://www.postgresql.org/docs/12/app-postmaster.html

I think once you change the macro to use this process name postmaster it should work in your CentOS context as well. Please try.

dmjaya commented 4 years ago

Hi, Thanks a lot, now database service is up. One question is it possible to use this template to monitor multiple remote databases in different locations? if it is yes how to write macros on the frontend.

Many Thanks.

stephankn commented 4 years ago

Sure. Just use the template like other templates in Zabbix to assign to your hosts. You can configure each host individually in Zabbix with different macros (Configuration/Host/Macros). I don't know why CentOS is using a different (outdated) process name. I will add a hint to the readme to highlight the possibility to easily configure the process name.

See Zabbix documentation for further details on how to monitor different hosts.

dmjaya commented 4 years ago

Noted and I'll check it. I appreciate your support only you gave this much support. Thanks Again.

shankcim1 commented 3 months ago

i am facing the same issue showing postgresql service is down alert on zabbix dashboard. all the remaining data is coming on dashboard my postgres db version is PostgreSQL 16.2 and zabbix agent version is installed is 4.4.1 not getting waht is the issue please can anyone suggest on this ... how this can be resolved Screenshot from 2024-05-28 15-54-26 Screenshot from 2024-05-28 15-53-16

stephankn commented 3 months ago

Can you please give details about your environment? What OS are you running, which version and which version of PostgreSQL? Please give details about the process name used by your PostgreSQL instance and what is the value of the PG_PROCESS_NAME macro.

Please also give details about which template is producing your warning. Please double-check that you are using the templates from this repository and check on the exact version. The string you quoted above is not the one of this template, which is "PostgreSQL service not running on {HOSTNAME}". I fear you are having trouble with a template from a different source.

shankcim1 commented 3 months ago

the os version is on which the postgres is running is CentOS Linux 7. PostgreSQL version is 16.2 and zabbix agent version is installed is 4.4.1 using the same template servers in other host group is getting monitored. i have just cloned that template and required port changes done in the template. and other more changes done like zabbix user. everything is same following are the triggers in my template image please find below image few data is coming image for below ping status it is showing 0. service is up and running on server image please find below setting fom macros image

stephankn commented 3 months ago

@shankcim1 Thanks for providing details. Your issue is different from the topic of this issue. The above problem was on a trigger at item "proc.num[{$PG_PROCESS_NAME}].last()"

And this is about a specific template you would have to install from this repository. Your problem points to a different template from a different repository. This template here was a while ago included within Zabbix. It is very likely that you are using an older version of this template here: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/postgresql/template_db_postgresql.yaml#537

As it is unrelated, please check for further support there. as per their documentation, Double-check that the required utilities for the user-scripts are available on your installation an returning proper results. https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/postgresql