Skip to content

try fix install with zabbix 7.0.2 #316

Description

@rodinux

hello,

I haven't found why I can't install the zabbix version 7.0.2 with yunohost package as we could do before...

The script install will use a python env (on a debian 12). We create first a LDAP user and try create_user with this user to be admin. It was working before, but now something go wrong...

zabbix_username="svc_zabbix_ldap"
zabbix_password=$(ynh_string_random --length=32)

mkdir -p /usr/share/zabbix-cli
python3 -m venv /usr/share/zabbix-cli
/usr/share/zabbix-cli/bin/pip install zabbix-cli-uio
# ldap zabbix user creation
ynh_print_info "Creating ldap zabbix user"
yunohost user create "$zabbix_username" --fullname "${zabbix_username//_}" --domain "$domain" --password "$zabbix_password" -q 0
ynh_config_add --template="zabbix-cli_default.toml" --destination="/usr/share/zabbix-cli/zabbix-cli.toml"
/usr/share/zabbix-cli/bin/zabbix-cli --config "/usr/share/zabbix-cli/zabbix-cli.toml" create_user "$zabbix_username" -username "$zabbix_username" --passwd "$zabbix_password" --role superadmin --groups 7
ynh_config_add --template="zabbix-cli.toml" --destination="/usr/share/zabbix-cli/zabbix-cli.toml"
ynh_safe_rm "/usr/share/zabbix-cli/.zabbix-cli_auth_token"

So here the script stop on the command /usr/share/zabbix-cli/bin/zabbix-cli --config "/usr/share/zabbix-cli/zabbix-cli.toml" create_user "$zabbix_username" -username "$zabbix_username" --passwd "$zabbix_password" --role superadmin --groups 7

I have this log

tail -f /usr/share/zabbix-cli/log/zabbix-cli.log 
2025-11-02 01:50:17,099 [zabbix_cli.pyzabbix.client][None][INFO][client.py:261 __init__]: JSON-RPC Server Endpoint: https://domain.tld/zabbix/api_jsonrpc.php
2025-11-02 01:50:17,099 [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-11-02 01:50:17,155 [httpx][None][INFO][_client.py:1025 _send_single_request]: HTTP Request: POST https://yunohost.packaging/zabbix/api_jsonrpc.php "HTTP/1.1 200 OK"
2025-11-02 01:50:17,156 [zabbix_cli.auth][None][WARNING][auth.py:358 login_with_credentials]: Failed to log in with username and password from config: Failed to get Zabbix version from API
2025-11-02 01:50:17,165 [httpx][None][INFO][_client.py:1025 _send_single_request]: HTTP Request: POST https://yunohost.packaging/zabbix/api_jsonrpc.php "HTTP/1.1 200 OK"
2025-11-02 01:50:17,165 [zabbix_cli.auth][None][WARNING][auth.py:358 login_with_credentials]: Failed to log in with username and password from file: Failed to get Zabbix version from API
2025-11-02 01:50:17,165 [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'}

the config file zabbix-cli.toml is edited like this

[api]
url = "https://yunohost.packaging/zabbix"
username = "Admin"
password = "zabbix"
auth_token = ""
verify_ssl = false

[app]
#use_session_file = true
#session_file = "/usr/share/zabbix-cli/.zabbix-cli_session.json"
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"
allow_insecure_auth_file = true
history = true
history_file = "/usr/share/zabbix-cli/history"
bulk_mode = "strict"
legacy_json_format = false

[app.commands.create_host]
create_interface = true
hostgroups = [
  "All-hosts",
]

[app.commands.create_group]
ro_groups = []
rw_groups = []

[app.commands.create_hostgroup]
ro_groups = []
rw_groups = []

[app.commands.create_templategroup]
ro_groups = []
rw_groups = []

[app.commands.create_user]
usergroups = []

[app.commands.create_notification_user]
usergroups = [
  "All-notification-users",
]

[app.commands.export]
directory = "/usr/share/zabbix-cli/exports"
format = "json"
timestamps = 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]

the files /usr/share/zabbix-cli/.zabbix-cli_auth_token are not created, I have also try add in the script something like this before the command zabbox-cli create_user, but it is the same result

echo "Admin::zabbix" > "/usr/share/zabbix-cli/.zabbix-cli_auth"
chmod 400 "/usr/share/zabbix-cli/.zabbix-cli_auth"

Why I can't as before create the user before ?? In my tests I seem always have a issue with the credentials If I push an enter it will ask for user(Admin)? and password? but always fails...

If it could help also below the nginx conf is like this

/etc/nginx/conf.d/domain.tld/zabbix.conf

#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location zabbix/ {

  # Path to source
  alias /usr/share/zabbix/ui/;

  index index.php;

  # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
  #client_max_body_size 50M;

  try_files $uri $uri/ index.php;
  location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;

    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param REMOTE_USER $remote_user;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME $request_filename;
  }
}

and the site conf /etc/nginx/conf.d/yunohost.packaging.conf

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 80;
    listen [::]:80;
    server_name yunohost.packaging;

    access_by_lua_file /usr/share/ssowat/access.lua;

    include /etc/nginx/conf.d/acme-challenge.conf.inc;

    location ^~ '/.well-known/ynh-diagnosis/' {
        alias /var/www/.well-known/ynh-diagnosis/;
    }

    location ^~ '/.well-known/autoconfig/mail/' {
        alias /var/www/.well-known/yunohost.packaging/autoconfig/mail/;
    }

    location / {
        return 301 https://$host$request_uri;
    }

    include /etc/nginx/conf.d/yunohost_http_errors.conf.inc;

    access_log /var/log/nginx/yunohost.packaging-access.log;
    error_log /var/log/nginx/yunohost.packaging-error.log;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name yunohost.packaging;

    include /etc/nginx/conf.d/security.conf.inc;

    ssl_certificate /etc/yunohost/certs/yunohost.packaging/crt.pem;
    ssl_certificate_key /etc/yunohost/certs/yunohost.packaging/key.pem;

    location ^~ '/.well-known/autoconfig/mail/' {
        alias /var/www/.well-known/yunohost.packaging/autoconfig/mail/;
    }

    access_by_lua_file /usr/share/ssowat/access.lua;

    include /etc/nginx/conf.d/yunohost.packaging.d/*.conf;

    include /etc/nginx/conf.d/yunohost_sso.conf.inc;
    include /etc/nginx/conf.d/yunohost_admin.conf.inc;
    include /etc/nginx/conf.d/yunohost_api.conf.inc;
    include /etc/nginx/conf.d/yunohost_http_errors.conf.inc;

    access_log /var/log/nginx/yunohost.packaging-access.log;
    error_log /var/log/nginx/yunohost.packaging-error.log;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions