Ad Widget

Collapse

Ошибка при Add Action

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Viewer
    Senior Member
    • Oct 2012
    • 131

    #1

    Ошибка при Add Action

    Добрый день!

    Zabbix 2.4.5
    CenOS 7 64bit
    mysql 5.6.23
    Неожиданно возникла следующая проблема при добавлении нового действия:
    Error in query [INSERT INTO opmessage (message,mediatypeid,default_msg,subject,operationid) VALUES ('Trigger: {TRIGGER.NAME}\r\nTrigger status: {TRIGGER.STATUS}\r\nTrigger severity: {TRIGGER.SEVERITY}\r\nTrigger URL: {TRIGGER.URL}\r\n\r\nItem values:\r\n\r\n1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}\r\n2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}\r\n3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}\r\n\r\nOriginal event ID: {EVENT.ID}',NULL,'1','{TRIGGER.STATUS}: {TRIGGER.NAME}','10')]
    [Duplicate entry '10' for key 'PRIMARY']
    > select operationid from opmessage ;
    +-------------+
    | operationid |
    +-------------+
    | 4 |
    | 5 |
    | 6 |
    | 7 |
    | 8 |
    | 9 |
    | 10 |
    | 11 |
    | 12 |
    +-------------+
    > select * from ids where table_name like "opmes%";
    +---------------+-----------------+--------+
    | table_name | field_name | nextid |
    +---------------+-----------------+--------+
    | opmessage_grp | opmessage_grpid | 1 |
    | opmessage_usr | opmessage_usrid | 9 |
    +---------------+-----------------+--------+
    Я понимаю что проблема в "nextid",
    Но я не совсем понимаю какое именно
    Когда я делаю вот так
    Code:
    > update ids set nextid=[B]13[/B] where table_name='opmessage_usr';
    это не решает проблему, получаю ту же ошибку.
    Помогите понять зависимость от этого nexid
    Last edited by Viewer; 30-10-2015, 11:56.
  • yukra
    Senior Member
    • Apr 2013
    • 1359

    #2
    Ошибка так же с id 10 или с id 13?

    Comment

    • Viewer
      Senior Member
      • Oct 2012
      • 131

      #3
      Originally posted by yukra
      Ошибка так же с id 10 или с id 13?
      Та же с 10, как будто я не то nextid меняю.
      Не совсем одинаково называются значения(Таблица opmessage , а в таблице ids opmessage_usr). Не могу найти какое.

      Comment

      • yukra
        Senior Member
        • Apr 2013
        • 1359

        #4
        Originally posted by Viewer
        Та же с 10, как будто я не то nextid меняю.
        Не совсем одинаково называются значения(Таблица opmessage , а в таблице ids opmessage_usr). Не могу найти какое.
        Включите логирование всех запросов в mysql, посмотрите какие select приходят перед "неполучающися инсертом". Скорей всего действительно не тот параметр меняете (или есть какой-то кэш, кэширующий ответ от mysql).

        Зы ну и мне еще почему то кажется что вам нужно апдейтить другое поле, хотя на практике я не проверял:
        Code:
        mysql> SELECT * FROM ids WHERE table_name LIKE 'operations' AND field_name LIKE 'operationid';
        +------------+-------------+--------+
        | table_name | field_name  | nextid |
        +------------+-------------+--------+
        | operations | operationid |     18 |
        +------------+-------------+--------+
        1 row in set (0.00 sec)

        Comment

        • Viewer
          Senior Member
          • Oct 2012
          • 131

          #5
          table_name |
          +------------+
          | operations|

          А вот у меня этого поля operations в таблице ids нет.(только opmessage_grp и opmessage_usr ). Поэтому и гадаю что править.
          Заббикс 2.4.5, посмотрел на другом заббиксе 2.4.6. - тоже нет.
          Подскажи свою версию
          Last edited by Viewer; 30-10-2015, 11:56.

          Comment

          • yukra
            Senior Member
            • Apr 2013
            • 1359

            #6
            Code:
            mysql>  select * from dbversion;
            +-----------+----------+
            | mandatory | optional |
            +-----------+----------+
            |   2040000 |  2040000 |
            +-----------+----------+
            1 row in set (0.00 sec)
            
            mysql>  select * from ids;
            +-----------------------+--------------------------+--------+
            | table_name            | field_name               | nextid |
            +-----------------------+--------------------------+--------+
            | acknowledges          | acknowledgeid            |   5253 |
            | actions               | actionid                 |     13 |
            | applications          | applicationid            |   4794 |
            | application_template  | application_templateid   |   4319 |
            | auditlog              | auditid                  |  19950 |
            | auditlog_details      | auditdetailid            |   2974 |
            | conditions            | conditionid              |     29 |
            | dchecks               | dcheckid                 |      3 |
            | drules                | druleid                  |      3 |
            | expressions           | expressionid             |     19 |
            | functions             | functionid               |  35807 |
            | graphs                | graphid                  |  11271 |
            | graphs_items          | gitemid                  |  33144 |
            | groups                | groupid                  |     29 |
            | hostmacro             | hostmacroid              |     49 |
            | hosts                 | hostid                   |  10458 |
            | hosts_groups          | hostgroupid              |    889 |
            | hosts_templates       | hosttemplateid           |   1774 |
            | housekeeper           | housekeeperid            | 223370 |
            | httpstep              | httpstepid               |    150 |
            | httpstepitem          | httpstepitemid           |    450 |
            | httptest              | httptestid               |    143 |
            | httptestitem          | httptestitemid           |    429 |
            | interface             | interfaceid              |    314 |
            | items                 | itemid                   |  79395 |
            | items_applications    | itemappid                |  64690 |
            | item_condition        | item_conditionid         |  31954 |
            | item_discovery        | itemdiscoveryid          |  29289 |
            | maintenances          | maintenanceid            |      9 |
            | maintenances_hosts    | maintenance_hostid       |     17 |
            | maintenances_windows  | maintenance_timeperiodid |     10 |
            | media                 | mediaid                  |     13 |
            | media_type            | mediatypeid              |      4 |
            | opcommand_hst         | opcommand_hstid          |      2 |
            | operations            | operationid              |     18 |
            | opgroup               | opgroupid                |      2 |
            | opmessage_grp         | opmessage_grpid          |     10 |
            | opmessage_usr         | opmessage_usrid          |      1 |
            | optemplate            | optemplateid             |     10 |
            | profiles              | profileid                |  11721 |
            | rights                | rightid                  |     33 |
            | screens               | screenid                 |     42 |
            | screens_items         | screenitemid             |    237 |
            | scripts               | scriptid                 |      3 |
            | sysmaps               | sysmapid                 |      2 |
            | sysmaps_elements      | selementid               |     24 |
            | sysmaps_links         | linkid                   |      2 |
            | sysmaps_link_triggers | linktriggerid            |      8 |
            | timeperiods           | timeperiodid             |     10 |
            | triggers              | triggerid                |  32489 |
            | trigger_depends       | triggerdepid             |   1228 |
            | users                 | userid                   |     16 |
            | users_groups          | id                       |     20 |
            | user_history          | userhistoryid            |     14 |
            | usrgrp                | usrgrpid                 |     16 |
            +-----------------------+--------------------------+--------+
            55 rows in set (0.00 sec)
            При этом:
            Code:
             [root@zabbix ~]# zabbix_server -V
            Zabbix server v2.4.6 (revision 54796) (10 August 2015)
            Compilation time: Aug 10 2015 13:10:01

            Comment

            • Viewer
              Senior Member
              • Oct 2012
              • 131

              #7
              У меня ids поменьше ) 43 против 55.
              Code:
              > select * from ids;
              +----------------------+------------------------+---------+
              | table_name           | field_name             | nextid  |
              +----------------------+------------------------+---------+
              | application_template | application_templateid |     983 |
              | applications         | applicationid          |    1418 |
              | auditlog             | auditid                |  992498 |
              | auditlog_details     | auditdetailid          |    4879 |
              | conditions           | conditionid            |     290 |
              | expressions          | expressionid           |      12 |
              | functions            | functionid             |   21996 |
              | globalmacro          | globalmacroid          |      10 |
              | graphs               | graphid                |   68949 |
              | graphs_items         | gitemid                | 1099261 |
              | group_prototype      | group_prototypeid      |      32 |
              | groups               | groupid                |      24 |
              | hostmacro            | hostmacroid            |      98 |
              | hosts                | hostid                 |   10260 |
              | hosts_groups         | hostgroupid            |     397 |
              | hosts_templates      | hosttemplateid         |     356 |
              | housekeeper          | housekeeperid          |   12908 |
              | interface            | interfaceid            |   30522 |
              | item_condition       | item_conditionid       |   42380 |
              | item_discovery       | itemdiscoveryid        |   10468 |
              | items                | itemid                 |   46824 |
              | items_applications   | itemappid              |   25353 |
              | mappings             | mappingid              |     104 |
              | media                | mediaid                |      15 |
              | media_type           | mediatypeid            |       5 |
              | opmessage_grp        | opmessage_grpid        |       1 |
              | opmessage_usr        | opmessage_usrid        |       9 |
              | profiles             | profileid              |    4781 |
              | regexps              | regexpid               |       3 |
              | rights               | rightid                |      40 |
              | screens              | screenid               |      30 |
              | screens_items        | screenitemid           |     125 |
              | sysmap_element_url   | sysmapelementurlid     |     253 |
              | sysmap_url           | sysmapurlid            |       1 |
              | sysmaps              | sysmapid               |      12 |
              | sysmaps_elements     | selementid             |     333 |
              | sysmaps_links        | linkid                 |     216 |
              | triggers             | triggerid              |   21446 |
              | user_history         | userhistoryid          |       7 |
              | users                | userid                 |      14 |
              | users_groups         | id                     |      48 |
              | usrgrp               | usrgrpid               |      13 |
              | valuemaps            | valuemapid             |      21 |
              +----------------------+------------------------+---------+
              43 rows in set (0.00 sec)

              Code:
              mysql> select * from dbversion;
              +-----------+----------+
              | mandatory | optional |
              +-----------+----------+
              |   2040000 |  2040000 |
              +-----------+----------+
              Извиняюсь! Я оказывается не обновился до 2.4.6 на этой инсталяции.
              Был уверен что обновлён.
              Code:
              # zabbix_server -V
              Zabbix server v2.4.5 (revision 53282) (21 April 2015)
              Last edited by Viewer; 30-10-2015, 11:56.

              Comment

              • Viewer
                Senior Member
                • Oct 2012
                • 131

                #8
                Обновился до 2.4.6
                В таблице нового не появилось.

                Comment

                • Viewer
                  Senior Member
                  • Oct 2012
                  • 131

                  #9
                  В общем руками вставил operations в ids.
                  Помогло. Не знаю куда пропасть могло.

                  Comment

                  • yukra
                    Senior Member
                    • Apr 2013
                    • 1359

                    #10
                    Originally posted by viewer
                    В общем руками вставил operations в ids.
                    Помогло. Не знаю куда пропасть могло.
                    Более интересно откуда значение 10 бралось

                    Comment

                    • Viewer
                      Senior Member
                      • Oct 2012
                      • 131

                      #11
                      Originally posted by yukra
                      Более интересно откуда значение 10 бралось
                      Ага).
                      Сохраню пост, буду твои значения вставлять в ids при необходимости).

                      Comment

                      Working...