Ad Widget

Collapse

Zabbix cant add new Hosts/items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ItOfficeIzzuesZab
    Junior Member
    • Feb 2023
    • 3

    #1

    Zabbix cant add new Hosts/items

    Hello i have encountered a problem which i seem unable to solve in any safe way.

    The problem i have is that i cannot add any new hosts, items or any other sorts of new things to zabbix via the web gui without getting this error.
    • Error in query [INSERT INTO hosts (hostid,status,proxy_hostid,tls_connect,tls_accept ,host,description,ipmi_authtype,ipmi_privilege,ipm i_username,ipmi_password,name) VALUES ('10740','0',NULL,'1','1','TEST01 ','','-1','2','','','TEST01')] [The user specified as a definer ('skip-grants user'@'skip-grants host') does not exist] [zabbix.php:22 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerHostCreate->doAction() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CHost->create() → DB::insert() → DB::insertBatch() → DBexecute() → trigger_error() in include/db.inc.php:367]
    • SQL statement execution has failed "INSERT INTO hosts (hostid,status,proxy_hostid,tls_connect,tls_accept ,host,description,ipmi_authtype,ipmi_privilege,ipm i_username,ipmi_password,name) VALUES ('10740','0',NULL,'1','1','TEST01 ','','-1','2','','','TEST01')".

    My first thought is that the DB host configuration was wrong but the username, database name, password all match and are correct in both the zabbix_server.conf and the web´s zabbix.conf.php files. My frontend, server and database is all installed on the same machine, so i use localhost which is also specified in both conf files, as is the use of port 3306.

    My second thought was that the zabbix user, was not granted admin rights to add new hosts/items into the zabbix's database, but it does have these privileges as can be seen in the screenshot below. I also tried to login to my database directly with my zabbix DB user, and attempted to see if i could create a table or a host manually which i could, so im 99% sure i ruled out that this problem could be caused by the zabbix user not having enough rights.


    I also tried to change the zabbix user i made for the DB, over to be the root user, to see if that would solve anything but it didnt.

    I have also tried to set the log_bin_trust_function_creators to both be on and off during testing, because it seemed to fix similar problems to this one for other people but it didnt work in this case.


    What does make me able to input items and hosts from the web gui is if i enable --skip-grant-tables. But due to obvious safety concerns i would like another solution, but this has shown me that this is highly likely some privilege issue that is at hand here but for the life of me i cant figure out why.


    Also just to mention, i use the zabbix version 6.2.5. My database is mysql v 8.0.31 and all of it runs on a linux machine running ubuntu 20.04.2.


    Please i would like some guidance on this if at all possible
  • ItOfficeIzzuesZab
    Junior Member
    • Feb 2023
    • 3

    #2
    I made the weirdest fix ever. So since i got the error

    Error in query [INSERT INTO hosts (hostid,status,proxy_hostid,tls_connect,tls_accept ,host,description,ipmi_authtype,ipmi_privilege,ipm i_username,ipmi_password,name) VALUES ('10740','0',NULL,'1','1','TEST01 ','','-1','2','','','TEST01')] [The user specified as a definer ('skip-grants user'@'skip-grants host') does not exist] [zabbix.php:22 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerHostCreate->doAction() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CHost->create() → DB::insert() → DB::insertBatch() → DBexecute() → trigger_error() in include/db.inc.php:367]

    SQL statement execution has failed "INSERT INTO hosts (hostid,status,proxy_hostid,tls_connect,tls_accept ,host,description,ipmi_authtype,ipmi_privilege,ipm i_username,ipmi_password,name) VALUES ('10740','0',NULL,'1','1','TEST01 ','','-1','2','','','TEST01')".

    And as mentioned, this line

    [The user specified as a definer ('skip-grants user'@'skip-grants host') does not exist]

    Was the main problem/told me what the problem was. And as a joke because i was frustrated and it felt like i had tried everything. I tried to create a user called 'skip-grants user'@'skip-grants host' and gave it the same password i use for the database, and to my confusement this worked after giving said user admin privileges.


    I would like to find out a better solution since this is a pretty dumb solution of which i have no idea of why works. xD

    Comment

    • Stian
      Junior Member
      • Jan 2023
      • 4

      #3
      Hi, i have the same issue, did you ever figure it out?

      Comment


      • ItOfficeIzzuesZab
        ItOfficeIzzuesZab commented
        Editing a comment
        No right now the only solution i made was the tempoary one that can be seen above unfortunatly.
    • adamphilip
      Junior Member
      • Aug 2023
      • 1

      #4
      Funny indeed. To bad there ain't any response about this. I have the same problem but only concerning discovery rules. I cannot create a discovery rule but can create other things OK.

      Comment

      Working...