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

Ombi something new [Request] #26

Closed
GugZi opened this issue Nov 20, 2018 · 4 comments
Closed

Ombi something new [Request] #26

GugZi opened this issue Nov 20, 2018 · 4 comments
Labels
more-info-requested Waiting on more information

Comments

@GugZi
Copy link

GugZi commented Nov 20, 2018

Hey i did try some copy paste, but can not really get it to work.

I want to get the data in to grafana to show what a user have requested and maybe som more stuff

`def get_user_request():
# Set the time here so we have one timestamp to work with
now = now_iso()

user_requests = []

influx_payload = []

for ombi_url, ombi_api_key, server_id in configuration.ombi_server_list:

    headers = {'X-Api-Key': ombi_api_key}

    get_user_request = requests.get('{}/api/v1/Request/movie'.format(ombi_url),
                                headers=headers,
                                verify=configuration.ombi_verify_ssl).json()['records']

    user_request = {d['id']: d for d in get_user_request}


    for request in user_request.keys():
        movie_name = '{}'.format(user_request[request]['title'])
        username = '{}'.format(user_request[request]['requestedUser']['userName'])
        user_requests.append((movie_name, username, user_request[request]['id'], user_request[request]['title']))

    for movie_name, username, id in user_requests:
        influx_payload.append(
            {
                "measurement": "Ombi",
                "tags": {
                    "type": "User_Request",
                    "ombiId": id,
                    "server": server_id
                },
                "time": now,
                "fields": {
                    "movie_name": movie_name,
                    "username": username
                }
            }
        )
        print('Movie Name: {0} | Username: {1}'.format(movie_name, username))
    # Empty missing or else things get foo bared
    user_requests = []

return influx_payload
@samwiseg0 samwiseg0 added the more-info-requested Waiting on more information label Nov 20, 2018
@samwiseg0
Copy link
Member

samwiseg0 commented Nov 20, 2018

What is the problem? Did you follow the setup instructions in the readme?

You should clone the repo and not copy and paste the code.

Edit: Are you modifying the code? That does not match what is in the repo

@GugZi
Copy link
Author

GugZi commented Nov 20, 2018

Yes thats what i'am trying to say, tryed to do so i can see i grafana what a user did requested. so that in grafana it will be like.. "Username | Movie Name" in a table e.g

@samwiseg0
Copy link
Member

Unfortunately, If you would like to modify the code to suit your needs you will have to do it on your own. Once you figure it out and would like to incorporate it into the repo you may do a pull request.

@dirtycajunrice
Copy link
Member

@GugZi As a hint, try to keep them as separate entities of information and collate them on the table (Let grafana do the leg work)

@Boerderij Boerderij locked and limited conversation to collaborators Mar 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
more-info-requested Waiting on more information
Projects
None yet
Development

No branches or pull requests

3 participants