Ad Widget

Collapse

Zabbix execute script/command on process startup.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gidot
    Junior Member
    • Oct 2013
    • 3

    #1

    Zabbix execute script/command on process startup.

    Hi,

    I would like to know if I can configure Zabbix to run a command/script on Zabbix clients when a process starts. The process that I'm referring here is PostgreSQL. My concern is not to monitor whether PostgreSQL is running or not, but more on triggering the command/script only when PostgreSQL fires up.

    I am fairly new to Zabbix and I would appreciate to get some hints or directions on how should I go on tackling this problem.

    Thanks.
  • ArtemK
    Senior Member
    • May 2013
    • 232

    #2
    Although it may be possible through creating action, which executes some script on server, when trigger, that checking if postgres running, fires. But, IMHO, that's definitely not monitoring system's job, why just not place your commands in postgres startup script?

    Comment

    • gidot
      Junior Member
      • Oct 2013
      • 3

      #3
      Originally posted by ArtemK
      Although it may be possible through creating action, which executes some script on server, when trigger, that checking if postgres running, fires. But, IMHO, that's definitely not monitoring system's job, why just not place your commands in postgres startup script?
      Yes, it doesn't really sound like a monitoring system's job. Let me explain further about the problem I'm facing. I'm open to any other solutions else than using Zabbix.

      I have 2 servers running on Linux (say server A and B). Server A and B provide high availability services, PostgreSQL and GlassFish in active/passive mode:

      Server A: PostgreSQL[active], GlassFish[passive]
      Server B: PostgreSQL[passive], GlassFish[active]

      My problem is whenever a failover occurs that is causing PostgreSQL to switch to Server B (or vice versa), I will have to flush the connection pool (using GlassFish command), or else users will encounter an error on the application. This will only happen in these 2 scenarios:

      Server A died:
      PostgreSQL goes to Server B, and I need to flush the connection pool. I need something to detect that PostgreSQL starts at Server B.

      Server A comes back to life:
      PostgreSQL goes back to Server A, and I need to flush the connection pool, from Server B since GlassFish is there. I need something to detect that PostgreSQL starts back at Server A.

      I could, as you said, write a sort of like a wrapper script to flush the connection pool, but since we are also running Zabbix agents on these servers, I was thinking if Zabbix could do the job.

      Sorry for the long post, I hope I manage to explain things right.

      Comment

      • ArtemK
        Senior Member
        • May 2013
        • 232

        #4
        jep, as I said, you can use actions to execute scripts on server, when postgres starts/shutdowns on server.

        Comment

        • gidot
          Junior Member
          • Oct 2013
          • 3

          #5
          Thanks.

          I decided to write a script and configure it as a part of my HA. Can't really figure out how to configure Zabbix to detect when PostgreSQL is 'up' instead 'monitoring that it's running' and time is running out.

          Comment

          Working...