Ad Widget

Collapse

[bug report] PHP-FPM: Process is not running

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FLFQ
    Junior Member
    • Mar 2021
    • 9

    #1

    [bug report] PHP-FPM: Process is not running

    server
    debian 10
    zabbix 5.0 TLS

    client
    debain 10
    php-fpm 7.3
    zabbix-agent2

    Template App PHP-FPM by Zabbix agent

    PHP-FPM: Number of processes running
    if {$PHP_FPM.PROCESS_NAME} = php-fpm
    retrun 0 ,is error

    if {$PHP_FPM.PROCESS_NAME} = nginx
    return 2 ,is ok

    ps aux |grep php-fpm
    have 2 processes

    sorry,my english very pool
  • FLFQ
    Junior Member
    • Mar 2021
    • 9

    #2
    I test proc.num["{$PHP_FPM.PROCESS_NAME}"]
    if proc.num("php-fpm") = 0,this is error,the ok num = 2
    proc.num("nginx") = 2 ,is ok
    I think proc.num is not support '-'??

    Comment

    • FLFQ
      Junior Member
      • Mar 2021
      • 9

      #3
      Click image for larger version

Name:	1.jpg
Views:	3519
Size:	51.9 KB
ID:	420097
      Click image for larger version

Name:	2.jpg
Views:	3539
Size:	50.7 KB
ID:	420098
      Click image for larger version

Name:	3.jpg
Views:	3474
Size:	42.0 KB
ID:	420099

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #4
        You may find the answer here
        https://www.zabbix.com/documentation..._mem_num_notes

        Also note that zabbix has permission to view other users ' processes.
        Last edited by Hamardaban; 05-03-2021, 08:38.

        Comment

        • FLFQ
          Junior Member
          • Mar 2021
          • 9

          #5
          Originally posted by Hamardaban
          You may find the answer here
          https://www.zabbix.com/documentation..._mem_num_notes

          Also note that zabbix has permission to view other users ' processes.
          I can't find zabbix-agent2 root user config doc


          Comment

          • Hamardaban
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • May 2019
            • 2713

            #6
            Are you sure that you need agent2 ? What's wrong with agent?

            Comment

            • FLFQ
              Junior Member
              • Mar 2021
              • 9

              #7
              Originally posted by Hamardaban
              You may find the answer here
              https://www.zabbix.com/documentation..._mem_num_notes

              Also note that zabbix has permission to view other users ' processes.
              now,zabbix-agent2 run as root
              proc.num["{$PHP_FPM.PROCESS_NAME}","www-data"]
              return = 0
              can't is ok!

              Comment

              • FLFQ
                Junior Member
                • Mar 2021
                • 9

                #8
                nginx run as www-data
                php-fpm run as www-data
                nginx return is right
                php-fpm return is error

                Comment

                • FLFQ
                  Junior Member
                  • Mar 2021
                  • 9

                  #9
                  Originally posted by Hamardaban
                  Are you sure that you need agent2 ? What's wrong with agent?
                  Agent have the same error.

                  test cmd:
                  zabbix_get -s 127.0.0.1 -k'proc.num[php-fpm]'

                  Comment

                  • FLFQ
                    Junior Member
                    • Mar 2021
                    • 9

                    #10
                    Click image for larger version

Name:	4.jpg
Views:	3459
Size:	48.2 KB
ID:	420129

                    test cmd:
                    zabbix_get -s 127.0.0.1 -k'proc.num[php-fpm]'

                    Comment

                    • demonspork
                      Junior Member
                      • Mar 2021
                      • 2

                      #11
                      This seems to be the approach to fix it: https://www.zabbix.com/documentation..._mem_num_notes
                      So if someone who is invested in this would like to make that update, I think it would solve a lot of annoyance with monitoring PHP-FPM.

                      Comment

                      • FLFQ
                        Junior Member
                        • Mar 2021
                        • 9

                        #12
                        fix it:

                        Click image for larger version  Name:	1.png Views:	0 Size:	50.8 KB ID:	421793

                        Click image for larger version  Name:	2.png Views:	0 Size:	48.7 KB ID:	421794
                        Click image for larger version  Name:	3.png Views:	0 Size:	32.9 KB ID:	421795

                        Click image for larger version

Name:	屏幕截图 2021-03-31 012618.png
Views:	3515
Size:	8.0 KB
ID:	421798
                        Attached Files
                        Last edited by FLFQ; 30-03-2021, 19:34.

                        Comment

                        • dgibbs
                          Junior Member
                          • Aug 2022
                          • 1

                          #13
                          Since it took me way to long to resolve this myself. Here is the simple fix for the PHP-FPM by Zabbix agent template

                          1. Add a new macro to the template

                          the user is typically www-data but do ps -ef|grep php-fpm to confirm

                          Macro: {$PHP_FPM.USER}
                          Value: www-data

                          2. Update existing Item "PHP-FPM: Number of processes running" key
                          from
                          Code:
                          proc.num["{$PHP_FPM.PROCESS_NAME}"]
                          to:
                          Code:
                          proc.num[,"{$PHP_FPM.USER}",,"{$PHP_FPM.PROCESS_NAME}"]

                          Comment

                          • vicxcl
                            Junior Member
                            • Mar 2022
                            • 2

                            #14
                            Originally posted by dgibbs
                            Since it took me way to long to resolve this myself. Here is the simple fix for the PHP-FPM by Zabbix agent template

                            1. Add a new macro to the template

                            the user is typically www-data but do ps -ef|grep php-fpm to confirm

                            Macro: {$PHP_FPM.USER}
                            Value: www-data

                            2. Update existing Item "PHP-FPM: Number of processes running" key
                            from
                            Code:
                            proc.num["{$PHP_FPM.PROCESS_NAME}"]
                            to:
                            Code:
                            proc.num[,"{$PHP_FPM.USER}",,"{$PHP_FPM.PROCESS_NAME}"]
                            Thanks for this. It helped me to monitor php-fpm in an old ubuntu14

                            Comment

                            Working...