Skip to content

Instantly share code, notes, and snippets.

@spikegrobstein
Created May 6, 2014 03:04
Show Gist options
  • Save spikegrobstein/e36b600776a81f713079 to your computer and use it in GitHub Desktop.
Save spikegrobstein/e36b600776a81f713079 to your computer and use it in GitHub Desktop.
graph who is streaming plex to graphite
#! /usr/bin/env ruby
require 'nokogiri'
require 'faraday'
host = 'http://plex.example.com:32400'
uri = '/status/sessions'
f = Faraday.new( host )
response = f.get(uri)
xml = Nokogiri::XML(response.body)
videos = xml.xpath '//Video'
puts "plex.clients.count #{ videos.count } #{ Time.now.to_i }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment