collector

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const URLLibrarySections = "http://%s:%d/library/sections"
View Source
const URLLibrarySectionsIDAll = "http://%s:%d/library/sections/%s/all"
View Source
const URLServerCapabilities = "http://%s:%d/"

TODO CHANGE INSECURE - do we have to query server directly? query it through plex.tv?

View Source
const URLSessions = "http://%s:%d/status/sessions"
View Source
const URLTranscodeSessions = "http://%s:%d/transcode/sessions"

Variables

This section is empty.

Functions

This section is empty.

Types

type APILibrarySections

type APILibrarySections struct {
	MediaContainer APILibrarySectionsMediaContainer `json:"MediaContainer"`
}

API Response for /library/sections which gives the library list

type APILibrarySectionsDirectory

type APILibrarySectionsDirectory struct {
	Key   string `json:"key"`
	Type  string `json:"type"`
	Title string `json:"title"`
}

type APILibrarySectionsIDAll

type APILibrarySectionsIDAll struct {
	MediaContainer APILibrarySectionsIDAllMediaContainer `json:"MediaContainer"`
}

API Response for /library/sections/id/all which gives the number of items by library

type APILibrarySectionsIDAllMediaContainer

type APILibrarySectionsIDAllMediaContainer struct {
	Size int `json:"size"`
}

type APILibrarySectionsMediaContainer

type APILibrarySectionsMediaContainer struct {
	Directory []APILibrarySectionsDirectory `json:"Directory"`
}

type APIServerCapabilities added in v1.0.0

type APIServerCapabilities struct {
	MediaContainer APIServerCapabilitiesMediaContainer `json:"MediaContainer"`
}

API Response for / which returns server capabilities

type APIServerCapabilitiesMediaContainer added in v1.0.0

type APIServerCapabilitiesMediaContainer struct {
	Version string `json:"version"`
}

type APIStatusSessions

type APIStatusSessions struct {
	MediaContainer APIStatusSessionsMediaContainer `json:"MediaContainer"`
}

API Response for /status/sections which give the number of current active sessions

type APIStatusSessionsMediaContainer

type APIStatusSessionsMediaContainer struct {
	Size int `json:"size"`
}

type APITranscodeSessions

type APITranscodeSessions struct {
	MediaContainer APITranscodeSessionsMediaContainer `json:"MediaContainer"`
}

API Response for /transcode/sessions which give the number of current active transcoding sessions

type APITranscodeSessionsMediaContainer

type APITranscodeSessionsMediaContainer struct {
	Size int `json:"size"`
}

type Directory

type Directory struct{}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Library

type Library struct {
	Name string
	Type string
	Size int
}

CLean model of Plex Media Server library

type Plex

type Plex interface {
	GetVersion() (string, error)
	CurrentSessionsCount() (int, error)
	GetTranscodeSessions() (int, error)
	GetLibraries() ([]Library, error)
}

type PlexMediaServer

type PlexMediaServer struct {
	Address    string
	Port       int
	Token      string
	HTTPClient HTTPClient
}

func (*PlexMediaServer) CurrentSessionsCount

func (p *PlexMediaServer) CurrentSessionsCount() (int, error)

func (*PlexMediaServer) GetLibraries

func (p *PlexMediaServer) GetLibraries() ([]Library, error)

GetLibraries returns the list of all libraries present on the Plex media object

func (*PlexMediaServer) GetTranscodeSessions

func (p *PlexMediaServer) GetTranscodeSessions() (int, error)

GetTranscodeSessions returns the number of current transcoding sessions

func (*PlexMediaServer) GetVersion added in v1.0.0

func (p *PlexMediaServer) GetVersion() (string, error)

type PlexMediaServerCollector

type PlexMediaServerCollector struct {
	MetricsInfo              *prometheus.Desc
	MetricsSessions          *prometheus.Desc
	MetricsTranscodeSessions *prometheus.Desc
	MetricsLibraries         *prometheus.Desc
	Server                   Plex
}

func NewPlexMediaServerCollector

func NewPlexMediaServerCollector(server Plex) *PlexMediaServerCollector

func (*PlexMediaServerCollector) Collect

func (p *PlexMediaServerCollector) Collect(ch chan<- prometheus.Metric)

func (*PlexMediaServerCollector) Describe

func (p *PlexMediaServerCollector) Describe(ch chan<- *prometheus.Desc)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL