Skip to content

Instantly share code, notes, and snippets.

@cdump
cdump / prom.py
Created January 3, 2020 08:50
cleargrass prometheus
#!/usr/bin/python3
from time import sleep, time
import miio
from prometheus_client import start_http_server, Gauge
if __name__ == '__main__':
MONITOR_IP = '192.168.88.100'
MONITOR_TOKEN = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
function get_part(file_hash, part_number, quality, timeout)
-- Trying to select the requested fragment
local t = v.fragments_space.index.main:select(file_hash, part_number, quality)
-- If it exists — returning immediately
if t ~= nil then
return t
end
-- Creating a key to identify the requested fragment, and an ipc channel, then writing it
function get_part(file_hash, part_number, quality, timeout)
-- Trying to select the requested fragment
local t = v.fragments_space.index.main:select(file_hash, part_number, quality)
-- If it exists — returning immediately
if t ~= nil then
return t
end
-- Creating a key to identify the requested fragment, and an ipc channel, then writing it