Add 'ombi_requests_shows'
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from sys import argv, exit
|
||||||
|
from subprocess import check_output
|
||||||
|
from re import search, sub
|
||||||
|
from json import loads, dumps
|
||||||
|
from os import environ
|
||||||
|
from requests import get
|
||||||
|
|
||||||
|
if len(argv) > 1:
|
||||||
|
print("graph_vlabel Ombi show requests")
|
||||||
|
print("graph_title Ombi show requests")
|
||||||
|
print("graph_category ombi_show_requests")
|
||||||
|
|
||||||
|
print("ombi_requests_shows_requested.label requested shows")
|
||||||
|
print("ombi_requests_shows_available.label available shows")
|
||||||
|
print("ombi_requests_shows_unavailable.label unavailable shows")
|
||||||
|
|
||||||
|
exit()
|
||||||
|
|
||||||
|
response = get(
|
||||||
|
"{}/{}".format(environ["host"], "api/v1/Request/tvlite"),
|
||||||
|
headers={"Accept": "application/json", "apikey": environ["apikey"]}
|
||||||
|
)
|
||||||
|
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
available = 0
|
||||||
|
requested = 0
|
||||||
|
unavailable = 0
|
||||||
|
|
||||||
|
for item in response.json():
|
||||||
|
for child in item["childRequests"]:
|
||||||
|
if child["available"] == True:
|
||||||
|
available = available + 1
|
||||||
|
else:
|
||||||
|
unavailable = unavailable + 1
|
||||||
|
|
||||||
|
requested = requested + 1
|
||||||
|
|
||||||
|
print "ombi_requests_shows_requested.value", requested
|
||||||
|
print "ombi_requests_shows_available.value", available
|
||||||
|
print "ombi_requests_shows_unavailable.value", unavailable
|
||||||
Reference in New Issue
Block a user