Files
munin-plugins/tinyrss_feeds

78 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python
# CFG
url = 'https://news.wahlberg.se/'
usr = 'admin'
pwd = 'unionen'
import sys
from ttrss.client import TTRClient
def autoconf():
print "yes"
def count():
client = TTRClient(url, usr, pwd)
client.login()
unread = client.get_unread_count()
hls = client.get_headlines(feed_id=-3)
fresh = 0
for article in hls:
fresh = fresh + 1
strd = client.get_headlines(feed_id=-1)
starred = 0
for article in strd:
starred = starred + 1
feeds = client.get_feed_count()
print "unread.value %s" % unread
print "fresh.value %s" % fresh
print "feeds.value %s" % feeds
print "starred.value %s" % starred
def config():
print """
graph_title Tiny Tiny RSS
graph_args -l 0 --base 1000
graph_args --base 1000
graph_vlabel Articles
graph_category Apps
graph_period second
graph_info This graph shows the current number RSS articles for Fredrik
unread.label Unread
unread.colour 663399
unread.max 10000
unread.min 0
unread.info The number of unread articles.
fresh.label Fresh
fresh.colour 336600
fresh.max 10000
fresh.min 0
fresh.info The number of articles within the last 24 hrs
feeds.label Feeds
feeds.colour 006699
feeds.max 10000
feeds.min 0
feeds.info The number of subscribed feeds
starred.label Starred
starred.colour FDD017
starred.max 10000
starred.min 0
starred.info The number of starred articles
"""
if len(sys.argv) > 1:
if sys.argv[1] == "autoconf":
autoconf()
elif sys.argv[1] == "config":
config()
else:
count()