Ad Widget

Collapse

since version 6.4 problems using zabbix-cli with a config file to create a user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rodinux
    Junior Member
    • Jun 2025
    • 1

    #1

    since version 6.4 problems using zabbix-cli with a config file to create a user

    Hello,

    I am a little contributor of Yunohost project. We manage a package to install zabbix connexted with ldap users.

    Since version 6.4 I have problems with the install script for zabbix, I try debug on this branch https://github.com/YunoHost-Apps/zab.../tree/fix-ldap

    we use zabbix-cli with a config file to create a user existing in the LDAP with a command like this

    Code:
    /usr/share/zabbix-cli/bin/zabbix-cli --config "/usr/share/zabbix-cli/zabbix-cli.toml" create_user "$zabbix_username" --firstname "$zabbix_username" --lastname "$zabbix_username" --passwd "$zabbix_password" --role superadmin --groups 7
    The file /usr/share/zabbix-cli/zabbix-cli.toml is like this


    Code:
    [api]
    url = "https://__DOMAIN____PATH__"
    username = "Admin"
    password = "zabbix"
    auth_token = ""
    verify_ssl = false
    
    [app]
    default_hostgroups = [
        "All-hosts",
    ]
    default_admin_usergroups = []
    default_create_user_usergroups = []
    default_notification_users_usergroups = [
        "All-notification-users",
    ]
    export_directory = "/usr/share/zabbix-cli/exports"
    export_format = "json"
    export_timestamps = false
    use_auth_token_file = true
    auth_token_file = "/usr/share/zabbix-cli/.zabbix-cli_auth_token"
    auth_file = "/usr/share/zabbix-cli/.zabbix-cli_auth"
    history = true
    history_file = "/usr/share/zabbix-cli/history"
    bulk_mode = "strict"
    allow_insecure_auth_file = true
    legacy_json_format = false
    
    [app.output]
    format = "table"
    color = true
    paging = false
    theme = "default"
    
    [logging]
    enabled = true
    log_level = "INFO"
    log_file = "/usr/share/zabbix-cli/log/zabbix-cli.log"
    
    [plugins]
    Reading the documentation I also have add before the command create_user something like
    Code:
    echo 'Admin::zabbix' > /usr/share/zabbix-cli/.zabbix-cli_auth`
    .

    But it seems the zabbix-cli wait for the password and nothing happen at this step... if I put enter I have a message
    Warning: ? Password: ✗ ERROR: Input cannot be empty.

    here some logs...

    Code:
    2025-06-04 15:56:26,135 [zabbix_cli.pyzabbix.client][None][INFO][client.py:261 __init__]: JSON-RPC Server Endpoint: https://testing.yunohost.packaging/api_jsonrpc.php
    2025-06-04 15:56:26,135 [zabbix_cli.auth][None][ERROR][auth.py:595 load_session_file]: Unable to load session file: [Errno Session file does not exist: %s] /root/.local/share/zabbix-cli/.zabbix-cli_session.json
    2025-06-04 15:56:26,203 [httpx][None][INFO][_client.py:1025 _send_single_request]: HTTP Request: POST https://testing.yunohost.packaging/api_jsonrpc.php "HTTP/1.1 500 Internal Server Error"
    2025-06-04 15:56:26,203 [zabbix_cli.auth][None][ERROR][auth.py:361 login_with_credentials]: Unexpected error logging in with username and password from config: Server error '500 Internal Server Error' for url 'https://testing.yunohost.packaging/api_jsonrpc.php'
    For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
    2025-06-04 15:56:26,211 [httpx][None][INFO][_client.py:1025 _send_single_request]: HTTP Request: POST https://testing.yunohost.packaging/api_jsonrpc.php "HTTP/1.1 500 Internal Server Error"
    2025-06-04 15:56:26,212 [zabbix_cli.auth][None][ERROR][auth.py:361 login_with_credentials]: Unexpected error logging in with username and password from file: Server error '500 Internal Server Error' for url 'https://testing.yunohost.packaging/api_jsonrpc.php'
    For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
    2025-06-04 15:56:26,212 [zabbix_cli.auth][None][INFO][auth.py:608 load_auth_token_file]: No auth token file found. Searched in {'/usr/share/zabbix-cli/.zabbix-cli_auth_token, /root/.local/share/zabbix-cli/.zabbix-cli_auth_token, /root/.zabbix-cli_auth_token'}
    2025-06-04 16:00:11,427 [zabbix_cli.pyzabbix.client][None][INFO][client.py:261 __init__]: JSON-RPC Server Endpoint: https://testing.yunohost.packaging/api_jsonrpc.php
    2025-06-04 16:00:11,427 [zabbix_cli.auth][None][ERROR][auth.py:595 load_session_file]: Unable to load session file: [Errno Session file does not exist: %s] /root/.local/share/zabbix-cli/.zabbix-cli_session.json
    2025-06-04 16:00:11,442 [httpx][None][INFO][_client.py:1025 _send_single_request]: HTTP Request: POST https://testing.yunohost.packaging/api_jsonrpc.php "HTTP/1.1 500 Internal Server Error"
    2025-06-04 16:00:11,442 [zabbix_cli.auth][None][ERROR][auth.py:361 login_with_credentials]: Unexpected error logging in with username and password from config: Server error '500 Internal Server Error' for url 'https://testing.yunohost.packaging/api_jsonrpc.php'
    For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
    2025-06-04 16:00:11,449 [httpx][None][INFO][_client.py:1025 _send_single_request]: HTTP Request: POST https://testing.yunohost.packaging/api_jsonrpc.php "HTTP/1.1 500 Internal Server Error"
    2025-06-04 16:00:11,449 [zabbix_cli.auth][None][ERROR][auth.py:361 login_with_credentials]: Unexpected error logging in with username and password from file: Server error '500 Internal Server Error' for url 'https://testing.yunohost.packaging/api_jsonrpc.php'
    For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
    2025-06-04 16:00:11,449 [zabbix_cli.auth][None][INFO][auth.py:608 load_auth_token_file]: No auth token file found. Searched in {'/usr/share/zabbix-cli/.zabbix-cli_auth_token, /root/.local/share/zabbix-cli/.zabbix-cli_auth_token, /root/.zabbix-cli_auth_token'}
    2025-06-04 16:00:24,204 [httpx][None][INFO][_client.py:1025 _send_single_request]: HTTP Request: POST https://testing.yunohost.packaging/api_jsonrpc.php "HTTP/1.1 500 Internal Server Error"
    2025-06-04 16:00:24,204 [zabbix_cli.auth][None][ERROR][auth.py:361 login_with_credentials]: Unexpected error logging in with username and password from prompt: Server error '500 Internal Server Error' for url 'https://testing.yunohost.packaging/api_jsonrpc.php'
    Why this operation need a request on the https://domain.tld/api_jsonrpc.php ? Why zabbix-cli did not read the file zabbix-cli.toml to have the correct password ??
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Maybe you should ask those, who created that zabbix-cli thing? That is not part of official stuff...

    Comment

    Working...