I'm using Zabbix 7.0.17 on RHEL 7. I am able to make API calls but always get back this error:
The frontend is having no issues talking to the database. I'm using a generated API token, which is Enabled, under a user that has API access Enabled. Under API Tokens it shows "Expires at" and "Last accessed" as Never. The latter is probably a symptom.
Here are two requests that both return the above error, where anything in [] just means it was redacted:
I've tried searching for an answer but haven't come up with anything that explains why the API would have this error while the frontend is working fine. I don't see anything suspicious in the zabbix_server.log. My zabbix_server.conf is attached. Hopefully I'm missing something obvious. Thanks.
Edit: In case it matters, Zabbix is installed in /usr/share/zabbix and this is the zabbix.conf in /etc/httpd/conf.d:
Code:
{"jsonrpc":"2.0","error":{"code":1,"message":"Error connecting to database: No such file or directory","data":""},"id":2}
Here are two requests that both return the above error, where anything in [] just means it was redacted:
Code:
curl --request POST --url 'http://localhost/zabbix/api_jsonrpc.php' --header 'Content-Type: application/json-rpc' --data '{"jsonrpc":"2.0","method":"apiinfo.version","params":{},"id":1}'
Code:
curl -X POST -H "Content-Type: application/json-rpc" -d '{
"jsonrpc": "2.0",
"method": "host.get",
"params": {
"output": ["hostid", "host", "name"],
"selectInterfaces": ["ip"]
},
"auth": "MY_TOKEN_REDACTED",
"id": 2
}' http://localhost/zabbix/api_jsonrpc.php
Edit: In case it matters, Zabbix is installed in /usr/share/zabbix and this is the zabbix.conf in /etc/httpd/conf.d:
Code:
# # Zabbix monitoring system php web frontend # Alias /zabbix /usr/share/zabbix <Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Require all granted <IfModule mod_php5.c> php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 4M php_value max_input_time 300 php_value max_input_vars 10000 php_value always_populate_raw_post_data -1 # php_value date.timezone Europe/Riga </IfModule> </Directory> <Directory "/usr/share/zabbix/conf"> Require all denied </Directory> <Directory "/usr/share/zabbix/app"> Require all denied </Directory> <Directory "/usr/share/zabbix/include"> Require all denied </Directory> <Directory "/usr/share/zabbix/local"> Require all denied </Directory>