8000 CSV output not implemented · Issue #305 · unioslo/zabbix-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CSV output not implemented #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mcbrineellis opened this issue May 8, 2025 · 2 comments
Open

CSV output not implemented #305

mcbrineellis opened this issue May 8, 2025 · 2 comments

Comments

@mcbrineellis
Copy link
mcbrineellis commented May 8, 2025

I tried to use the csv output option which is listed in the documentation: https://unioslo.github.io/zabbix-cli/guide/configuration/#appoutput which returned the error ValueError: Unknown output format <OutputFormat.CSV: 'csv'>.

It seems that this has not yet been implemented, as it is listed as TODO in render.py:

# TODO: implement CSV

@mcbrineellis
Copy link
Author
mcbrineellis commented May 8, 2025

I came up with a workaround for this using jq with the show_hosts command to generate a CSV of hosts from Zabbix.

First set format = "json" under [app.output] in zabbix-cli.toml:

[app.output]
format = "json"
color = true   
paging = false 
zabbix-cli show_hosts | jq -r \
  '(["hostid", "host", "groups", "templates", "zabbix_agent", "maintenance_status", "status", "proxy_name"] | @csv),
  ( .result[] | [.hostid, .host, (.groups | map(.name) | join("; ")), (.templates | map(.name) | join("; ")), .zabbix_agent, .maintenance_status, .status, (.proxy.name // "")] | @csv)' \
>> output.csv

@mcbrineellis
Copy link
Author

Here's the same thing but for alarms:

zabbix-cli show_alarms | jq -r \
      '(["triggerid", "host", "description", "severity", "lastchange", "age"] | @csv),
      ( .result[] | [.triggerid, .hostname, .description, .severity, .lastchange, .age] | @csv)' \
    >> output.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0