Skip to content

Cannot create item: item with the same key #71

@YogSottot

Description

@YogSottot

First of all, thank you for this project.

Software used:

  • debian 12
  • zabbix 7.0.6
  • zabbix_agent2
  • scripts latest from git
sudo -u zabbix sudo /etc/zabbix/scripts/rvalitov-zabbix-php-fpm/zabbix_php_fpm_discovery.sh POOL_PATH debug
Debug mode enabled
Current user is root
Status path to be used: /fpmstatus.php
Local directory is /etc/zabbix/scripts/rvalitov-zabbix-php-fpm
Helper script /etc/zabbix/scripts/rvalitov-zabbix-php-fpm/zabbix_php_fpm_status.sh is reachable
Reading cache file of pools /var/cache/zabbix-php-fpm/php_fpm_results.cache...
List of pools loaded from cache pools file:
#1 7.4 /run/php/php7.4-fpm.sock dynamic
#2 7.4 /run/php/php7.4-user0001-fpm.sock dynamic
#3 7.4-user0001 /run/php/php7.4-user0001-fpm.sock dynamic
#4 8.2 /run/php/php8.2-fpm.sock dynamic
#5 8.3 /run/php/php8.3-fpm.sock dynamic
#6 8.3 /run/php/php8.3-user0003-fpm.sock dynamic
#7 8.3-user0003 /run/php/php8.3-user0003-fpm.sock dynamic
Reading file of pending pools /var/cache/zabbix-php-fpm/php_fpm_pending.cache...
List of pools loaded from pending pools file:
Started analysis of pool 7.4, PID(s):  -p 146197 -p 159461
Checking process: php-fpm7. 146197   bitrix   10u  unix 0xffff90feb60b2a80      0t0 244732 /run/php/php7.4-fpm.sock type=STREAM (LISTEN)
Found socket /run/php/php7.4-fpm.sock
Added pool 7.4 /run/php/php7.4-fpm.sock to pending list
Checking process: php-fpm7. 159461 user0001   10u  unix 0xffff90feb60b2200      0t0 244730 /run/php/php7.4-user0001-fpm.sock type=STREAM (LISTEN)
Found socket /run/php/php7.4-user0001-fpm.sock
Added pool 7.4 /run/php/php7.4-user0001-fpm.sock to pending list
Started analysis of pool 7.4-user0001, PID(s):  -p 159461
Checking process: php-fpm7. 159461 user0001   10u  unix 0xffff90feb60b2200      0t0 244730 /run/php/php7.4-user0001-fpm.sock type=STREAM (LISTEN)
Found socket /run/php/php7.4-user0001-fpm.sock
Added pool 7.4-user0001 /run/php/php7.4-user0001-fpm.sock to pending list
Started analysis of pool 8.2, PID(s):  -p 77178
Checking process: php-fpm8. 77178 bitrix   11u  unix 0xffff90fe878e4440      0t0  37553 /run/php/php8.2-fpm.sock type=STREAM (LISTEN)
Found socket /run/php/php8.2-fpm.sock
Added pool 8.2 /run/php/php8.2-fpm.sock to pending list
Checking process: php-fpm8. 77178 bitrix    4u  unix 0xffff90fe878e5100      0t0  37534 type=STREAM (CONNECTED)
Error: specified socket type=STREAM is not valid
Started analysis of pool 8.3, PID(s):  -p 146285 -p 146286
Checking process: php-fpm8. 146285 user0003   11u  unix 0xffff90fe847d8000      0t0 245936 /run/php/php8.3-user0003-fpm.sock type=STREAM (LISTEN)
Found socket /run/php/php8.3-user0003-fpm.sock
Added pool 8.3 /run/php/php8.3-user0003-fpm.sock to pending list
Checking process: php-fpm8. 146285 user0003    4u  unix 0xffff90fe847d9dc0      0t0 245916 type=STREAM (CONNECTED)
Error: specified socket type=STREAM is not valid
Checking process: php-fpm8. 146286   bitrix   11u  unix 0xffff90fe847daa80      0t0 245938 /run/php/php8.3-fpm.sock type=STREAM (LISTEN)
Found socket /run/php/php8.3-fpm.sock
Added pool 8.3 /run/php/php8.3-fpm.sock to pending list
Checking process: php-fpm8. 146286   bitrix    4u  unix 0xffff90fe847d9dc0      0t0 245916 type=STREAM (CONNECTED)
Error: specified socket type=STREAM is not valid
Started analysis of pool 8.3-user0003, PID(s):  -p 146285
Checking process: php-fpm8. 146285 user0003   11u  unix 0xffff90fe847d8000      0t0 245936 /run/php/php8.3-user0003-fpm.sock type=STREAM (LISTEN)
Found socket /run/php/php8.3-user0003-fpm.sock
Added pool 8.3-user0003 /run/php/php8.3-user0003-fpm.sock to pending list
Checking process: php-fpm8. 146285 user0003    4u  unix 0xffff90fe847d9dc0      0t0 245916 type=STREAM (CONNECTED)
Error: specified socket type=STREAM is not valid
Pending list generated:
#1 7.4 /run/php/php7.4-fpm.sock
#2 7.4 /run/php/php7.4-user0001-fpm.sock
#3 7.4-user0001 /run/php/php7.4-user0001-fpm.sock
#4 8.2 /run/php/php8.2-fpm.sock
#5 8.3 /run/php/php8.3-user0003-fpm.sock
#6 8.3 /run/php/php8.3-fpm.sock
#7 8.3-user0003 /run/php/php8.3-user0003-fpm.sock
Processing pools
Processing pool 7.4 /run/php/php7.4-fpm.sock
Status data for pool 7.4, socket /run/php/php7.4-fpm.sock, status path /fpmstatus.php is valid
Detected pool's process manager is dynamic
Pool 7.4 /run/php/php7.4-fpm.sock is in cache, deleting...
Added pool 7.4 /run/php/php7.4-fpm.sock to cache list
Success: socket /run/php/php7.4-fpm.sock returned valid status data
Removed pool 7.4 /run/php/php7.4-fpm.sock from pending list
Check execution time: stop required, elapsed 4589 ms
Saving pending pools list to file /var/cache/zabbix-php-fpm/php_fpm_pending.cache...
List of pools to be saved to cache pools file:
#1 7.4 /run/php/php7.4-fpm.sock dynamic
#2 7.4 /run/php/php7.4-user0001-fpm.sock dynamic
#3 7.4-user0001 /run/php/php7.4-user0001-fpm.sock dynamic
#4 8.2 /run/php/php8.2-fpm.sock dynamic
#5 8.3 /run/php/php8.3-fpm.sock dynamic
#6 8.3 /run/php/php8.3-user0003-fpm.sock dynamic
#7 8.3-user0003 /run/php/php8.3-user0003-fpm.sock dynamic
Saving cache file to file /var/cache/zabbix-php-fpm/php_fpm_results.cache...
Resulting JSON data for Zabbix:
{"data":[{"{#POOLNAME}":"7.4","{#POOLSOCKET}":"/run/php/php7.4-fpm.sock"},{"{#POOLNAME}":"7.4","{#POOLSOCKET}":"/run/php/php7.4-user0001-fpm.sock"},{"{#POOLNAME}":"7.4-user0001","{#POOLSOCKET}":"/run/php/php7.4-user0001-fpm.sock"},{"{#POOLNAME}":"8.2","{#POOLSOCKET}":"/run/php/php8.2-fpm.sock"},{"{#POOLNAME}":"8.3","{#POOLSOCKET}":"/run/php/php8.3-fpm.sock"},{"{#POOLNAME}":"8.3","{#POOLSOCKET}":"/run/php/php8.3-user0003-fpm.sock"},{"{#POOLNAME}":"8.3-user0003","{#POOLSOCKET}":"/run/php/php8.3-user0003-fpm.sock"}]}

pool

{
   "data":[
      {
         "{#POOLNAME}":"7.4",
         "{#POOLSOCKET}":"/run/php/php7.4-fpm.sock"
      },
      {
         "{#POOLNAME}":"7.4",
         "{#POOLSOCKET}":"/run/php/php7.4-user0001-fpm.sock"
      },
      {
         "{#POOLNAME}":"7.4-user0001",
         "{#POOLSOCKET}":"/run/php/php7.4-user0001-fpm.sock"
      },
      {
         "{#POOLNAME}":"8.2",
         "{#POOLSOCKET}":"/run/php/php8.2-fpm.sock"
      },
      {
         "{#POOLNAME}":"8.3",
         "{#POOLSOCKET}":"/run/php/php8.3-fpm.sock"
      },
      {
         "{#POOLNAME}":"8.3",
         "{#POOLSOCKET}":"/run/php/php8.3-user0003-fpm.sock"
      },
      {
         "{#POOLNAME}":"8.3-user0003",
         "{#POOLSOCKET}":"/run/php/php8.3-user0003-fpm.sock"
      }
   ]
}

Unique pool names are specified in all configs.

cat /etc/php/8.3/fpm/pool.d/user0003.conf 
;
; Ansible managed
;

[8.3-user0003]
listen = /run/php/php8.3-user0003-fpm.sock
cat /etc/php/7.4/fpm/pool.d/user0001.conf 
;
; Ansible managed
;

[7.4-user0001]
listen = /run/php/php7.4-user0001-fpm.sock

Basically everything works. So it's not a big deal.
image

image

But as you can see, the script output contains the same {#POOLNAME} for different sockets.
example:

         "{#POOLNAME}":"7.4",
         "{#POOLSOCKET}":"/run/php/php7.4-fpm.sock"
      },
      {
         "{#POOLNAME}":"7.4",
         "{#POOLSOCKET}":"/run/php/php7.4-user0001-fpm.sock"
      },

Which leads to error output in the discovery section

Cannot create item: item with the same key "php-fpm.cpu[7.4]" already exists.
Cannot create item: item with the same key "php-fpm.cpu[8.3]" already exists.
Cannot create item: item with the same key "php-fpm.queue[/run/php/php7.4-user0001-fpm.sock]" already exists.
Cannot create item: item with the same key "php-fpm.queue[/run/php/php8.3-user0003-fpm.sock]" already exists.
Cannot create item: item with the same key "php-fpm.status[/run/php/php7.4-user0001-fpm.sock,{$PHP_FPM_STATUS_URL}]" already exists.
Cannot create item: item with the same key "php-fpm.status[/run/php/php8.3-user0003-fpm.sock,{$PHP_FPM_STATUS_URL}]" already exists.
Cannot create item: item with the same key "proc.cpu.util["php-fpm: pool 7.4"]" already exists.
Cannot create item: item with the same key "proc.cpu.util["php-fpm: pool 8.3"]" already exists.
Cannot create item: item with the same key "proc.mem["php-fpm: pool 7.4",,,,pmem]" already exists.
Cannot create item: item with the same key "proc.mem["php-fpm: pool 8.3",,,,pmem]" already exists.
Cannot create item: item with the same key "proc.mem["php-fpm: pool 7.4",,,,rss]" already exists.
Cannot create item: item with the same key "proc.mem["php-fpm: pool 8.3",,,,rss]" already exists.
Cannot create item: item with the same key "php-fpm.accepted_conn[/run/php/php7.4-user0001-fpm.sock]" already exists.
Cannot create item: item with the same key "php-fpm.accepted_conn[/run/php/php8.3-user0003-fpm.sock]" already exists.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions