problems.get
picardrulez opened this issue · 7 comments
Is there a way to use this library to use the problems.get api function?
Currently the Problems API is not implemented. PRs a welcome!
You can of course, create your own custom requests using a map
and pass it to Zabbix API in a Request
.
aaaaaah man I figured as much. I'm actually going through your code right now trying to figure out how everything else is using that .Get function. I'm not too skilled of a developer (my background is linux administration) but hopefully I can figure this out.
I think I've figured it out, but I've been writing it within my application that's using the library. I've gotta run to kung fu class but when I get home tonight I'll relearn how to write a library, throw my changes in there to make sure it works within the library, and then send the branch up here.
So I'm not getting any errors but I'm also not getting anything returned. I've been using host.go and host_json.go as a guide for building this, so let me run this by you so you can tell me if I understand all of this correctly:
host.go:
I don't think the constants pertain to the problems.get method so I skipped that
Host struct: this is a struct for the host object that the api will return from the request that gets translated from the json struct
HostGetParms struct: this is a struct for building parameters for the api request
GetHosts: this is the function that will actually be called by the application using the go-zabbix package
host_json.go:
jHost struct: this is the struct used to get the actual json object returned from the api
Host() function: this function maps the jHost struct into the Host struct
jHosts: this creates a slice of hosts called jHosts
Hosts() function: this actually puts the hosts into the jHosts slice
Do I understand all of that correctly? I hope not because I'm definitely missing something lolol
I'm starting to wonder if problem.get is what I actually need. problem, trigger, and event is all starting to meld together for me. I'm basically just trying to get zabbix to tell me how many active issues are open for hosts via a specific group id.
Alright, I think I've figured it out. What I actually needed was getTriggers with only_true (RecentProblemOnly in your package). You can close this issue if you like. Would you like my getProblems branch since I wrote it out already? I can just trash it otherwise, not entirely sure if it's working anyway.