Ad Widget

Collapse

zabbix API?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ly365
    Junior Member
    • Mar 2011
    • 1

    #1

    zabbix API?

    php code:
    Code:
    require_once('./include/config.inc.php');
    #
    $params1 = array('user'=>'admin', 'password'=>'zabbix');
    $obj = new czbxrpc();
    $obj->call('user.login', $params1);
    $arr = czbxrpc::$result;
    print_r($arr);
    
    
    
    $params1 = array(
    );
    
    $obj->call('user.get', $params1);
    $arr1 = czbxrpc::$result;
    print_r($arr1);
    
    ?>

    Code:
    Array
    (
        [result] => 38b96dde00f557d5848fa0ff41ed4c1a
    )
    Array
    (
        [error] => 200
        [data] => Not authorized
    )

    why?
    return [data] => Not authorized ???????????
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    The error message is correct, the user is not authorized...

    Make sure the user you are using to access the API is a member of a group with API access permissions as denoted in Administration -> Users (user groups).
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    Working...