Ad Widget

Collapse

delete host using zabcon on server 1.8.3

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • horatiu
    Junior Member
    • Aug 2010
    • 2

    #1

    delete host using zabcon on server 1.8.3

    I get an error when using zabcon to delete a host on the zabbix server 1.8.3

    The command and error are below:

    {"auth":"e9fa9c909efd386cddf4e4c7b68dc736","method ":"host.delete","id":3,"params":[{"hostid":10055}],"jsonrpc":"2.0"}

    Error code: -32500
    Error message: Application error.
    Error data: [ CHost::delete ] You do not have permission to perform this operation

    host exist and I'm logged it before the call as Admin, so there should be no problem regarding the rights. Doing the same thing from the interface logged as Admin succeeds.

    any advice would be welcome

    thanks
    horatiu
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    hmm... this does look like a bug in api. please, report on the tracker.
    Zabbix 3.0 Network Monitoring book

    Comment

    • zaicnupagadi
      Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2010
      • 73

      #3
      I have similar problem:

      Unable to update: Array ( [code] => -32500 [message] => Application error. [data] => [ CTemplate::massAdd ] You do not have permission to perform this operation )

      While I try to link a host to a template:

      ZabbixAPI::query('template','massAdd',array( 'templates' => array('templateid' => 10077),'hosts' => array( 'hostid' => 11058)))
      or die('Unable to update: '.print_r(ZabbixAPI::getLastError(),true));

      dors anyone has resolution?

      Cheers!
      Pawel J.

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        note that you must have full permissions for the template and host in question. posting raw json, sent to the api, might also be useful
        Zabbix 3.0 Network Monitoring book

        Comment

        • zaicnupagadi
          Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2010
          • 73

          #5
          Being honest I don't really understand the "posting raw json" term. I send the full content of my file, I hope it will help to find any mistakes of mine.

          Below the code, many thanks for help!

          <?php

          require_once('include/config.inc.php');
          require_once("zabbixapi_class/ZabbixAPI.class.php");
          ZabbixAPI::debugEnabled(TRUE);
          // This logs into Zabbix, and returns false if it fails
          ZabbixAPI::login('http://IP/','login','password')
          or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));

          ZabbixAPI::query('template','update',array('templa teid'=>11058, 'hosts'=> array('host' => 10049, 'host' => 10077 )))
          or die('Unable to update: '.print_r(ZabbixAPI::getLastError(),true));
          echo "Host has been updated!\n";

          ?>

          Comment

          • richlv
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2005
            • 3112

            #6
            the solution you use eventually sends a json string to the api. that string, the exact one being sent, would allow more people to help, as it would not be limited to knowing a single lib
            Zabbix 3.0 Network Monitoring book

            Comment

            • zaicnupagadi
              Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2010
              • 73

              #7
              I have attached the file with php code, I have downloaded it from http://andrewfarley.com/php/zabbix-1...php-class-v1-0, I hope the file include needed information.

              I hope that somebody's also using it, and can help.
              Attached Files

              Comment

              Working...