7 releases
0.3.1 | Sep 12, 2024 |
---|---|
0.3.0 | Sep 12, 2024 |
0.2.4 | Sep 11, 2024 |
0.2.2 | Aug 21, 2024 |
0.1.0 | Jan 18, 2024 |
#530 in Web programming
271 downloads per month
74KB
1.5K
SLoC
Zabbix API
This is a partial implementation of the Zabbix API client, created specifically for my pet project, wszl. Due to the extensive nature of the Zabbix API, I have been unable to allocate sufficient time to cover 100% functionality.
Getting started
Add dependencies in your Cargo.toml
:
[dependencies]
zabbix-api = "0.3.1"
Then use:
use reqwest::blocking::ClientBuilder;
use zabbix_api::client::v6::ZabbixApiV6Client;
use zabbix_api::client::ZabbixApiClient;
fn main() {
let http_client = ClientBuilder::new()
.danger_accept_invalid_certs(false) // Set true if you're using self-signed certificates.
.build().unwrap();
let client = ZabbixApiV6Client::new(http_client, "http://localhost:3080/api_jsonrpc.php");
match client.get_auth_session("Admin", "zabbix") {
Ok(session) => println!("session: {session}"),
Err(e) => {
eprintln!("error: {}", e);
panic!("unexpected error")
}
}
}
- You can make raw api calls.
Versions
- Stable:
0.2.2
- Dev:
0.2.3
API Methods
- Get API info
- Authentication
- RAW API Call
- Search
- Host Group
- Hosts
- Items
- Triggers
- Web-scenarios
- User Group
- User
- Create
- Host Group
- Host
- Item
- Trigger
- Web-scenario
- User Group
- User
TODO
- Add examples
- Use enums for Zabbix types (trigger type, value type, etc.)
Limitations
- API support: v6
- Synchronous requests only
Dependencies
~4–15MB
~194K SLoC