Skip to content
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

problems.get #25

Open
picardrulez opened this issue Jun 27, 2019 · 7 comments
Open

problems.get #25

picardrulez opened this issue Jun 27, 2019 · 7 comments

Comments

@picardrulez
Copy link

Is there a way to use this library to use the problems.get api function?

@cavaliercoder
Copy link
Collaborator

Currently the Problems API is not implemented. PRs a welcome!

@cavaliercoder
Copy link
Collaborator

You can of course, create your own custom requests using a map and pass it to Zabbix API in a Request.

@picardrulez
Copy link
Author

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.

@picardrulez
Copy link
Author

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.

@picardrulez
Copy link
Author

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

@picardrulez
Copy link
Author

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.

@picardrulez
Copy link
Author

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.

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

2 participants