What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Get information from API

Votes:

0

Hi,

Im wondering how I could get information through an API? I have python based monitoring and tracking tool for my Plex Media server. It is possible to get information through the API in the tool.

Is there any way to get this information in to PRTG in some way?

Here is some examples

Get plays per month

Get graph data by month.

Required parameters:
    None

Optional parameters:
    time_range (str):       The number of months of data to return
    y_axis (str):           "plays" or "duration"
    user_id (str):          The user id to filter the data
    grouping (int):         0 or 1

Returns:
    json:
        {"categories":
            ["Jan 2016", "Feb 2016", "Mar 2016", ...]
         "series":
            [{"name": "Movies", "data": [...]}
             {"name": "TV", "data": [...]},
             {"name": "Music", "data": [...]}
             ]
         }

Get activity

Get the current activity on the PMS.

Required parameters:
    None

Optional parameters:
    session_key (int):    Session key for the session info to return, OR
    session_id (str):     Session ID for the session info to return

Returns:
    json:
        {"lan_bandwidth": 25318,
         "sessions": [
             {
                 "actors": [
                     "Kit Harington",
                     "Emilia Clarke",
                     "Isaac Hempstead-Wright",
                     "Maisie Williams",
                     "Liam Cunningham",
                 ],
                 "added_at": "1461572396",
                 "allow_guest": 1,
                 "art": "/library/metadata/1219/art/1503306930",
                 "aspect_ratio": "1.78",
                 "audience_rating": "",
                 "audience_rating_image": "rottentomatoes://image.rating.upright",
                 "audio_bitrate": "384",
                 "audio_bitrate_mode": "",
                 "audio_channel_layout": "5.1(side)",
                 "audio_channels": "6",
                 "audio_codec": "ac3",
                 "audio_decision": "direct play",
                 "audio_language": "",
                 "audio_language_code": "",
                 "audio_profile": "",
                 "audio_sample_rate": "48000",
                 "bandwidth": "25318",
                 "banner": "/library/metadata/1219/banner/1503306930",
                 "bif_thumb": "/library/parts/274169/indexes/sd/1000",
                 "bitrate": "10617",
                 "channel_stream": 0,
                 "collections": [],
                 "container": "mkv",
                 "content_rating": "TV-MA",
                 "deleted_user": 0,
                 "device": "Windows",
                 "directors": [
                     "Jeremy Podeswa"
                 ],
                 "do_notify": 0,
                 "duration": "2998272",
                 "email": "[email protected]",
                 "file": "/media/TV Shows/Game of Thrones/Season 06/Game of Thrones - S06E01 - The Red Woman.mkv",
                 "file_size": "3979115377",
                 "friendly_name": "Jon Snow",
                 "full_title": "Game of Thrones - The Red Woman",
                 "genres": [
                     "Adventure",
                     "Drama",
                     "Fantasy"
                 ],
                 "grandparent_rating_key": "1219",
                 "grandparent_thumb": "/library/metadata/1219/thumb/1503306930",
                 "grandparent_title": "Game of Thrones",
                 "guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en",
                 "height": "1078",
                 "id": "",
                 "indexes": 1,
                 "ip_address": "10.10.10.1",
                 "ip_address_public": "64.123.23.111",
                 "is_admin": 1,
                 "is_allow_sync": null,
                 "is_home_user": 1,
                 "is_restricted": 0,
                 "keep_history": 1,
                 "labels": [],
                 "last_viewed_at": "1462165717",
                 "library_name": "TV Shows",
                 "local": "1",
                 "location": "lan",
                 "machine_id": "lmd93nkn12k29j2lnm",
                 "media_index": "1",
                 "media_type": "episode",
                 "optimized_version": 0,
                 "optimized_version_profile": "",
                 "optimized_version_title": "",
                 "originally_available_at": "2016-04-24",
                 "original_title": "",
                 "parent_media_index": "6",
                 "parent_rating_key": "153036",
                 "parent_thumb": "/library/metadata/153036/thumb/1503889210",
                 "parent_title": "Season 6",
                 "platform": "Plex Media Player",
                 "platform_name": "plex",
                 "platform_version": "2.4.1.787-54a020cd",
                 "player": "Castle-PC",
                 "product": "Plex Media Player",
                 "product_version": "3.35.2",
                 "profile": "Konvergo",
                 "progress_percent": "0",
                 "quality_profile": "Original",
                 "rating": "7.8",
                 "rating_image": "rottentomatoes://image.rating.ripe",
                 "rating_key": "153037",
                 "relay": 0,
                 "section_id": "2",
                 "session_id": "helf15l3rxgw01xxe0jf3l3d",
                 "session_key": "27",
                 "shared_libraries": [
                     "10",
                     "1",
                     "4",
                     "5",
                     "15",
                     "20",
                     "2"
                 ],
                 "sort_title": "Red Woman",
                 "state": "playing",
                 "stream_aspect_ratio": "1.78",
                 "stream_audio_bitrate": "384",
                 "stream_audio_bitrate_mode": "",
                 "stream_audio_channel_layout": "5.1(side)",
                 "stream_audio_channel_layout_": "5.1(side)",
                 "stream_audio_channels": "6",
                 "stream_audio_codec": "ac3",
                 "stream_audio_decision": "direct play",
                 "stream_audio_language": "",
                 "stream_audio_language_code": "",
                 "stream_audio_sample_rate": "48000",
                 "stream_bitrate": "10617",
                 "stream_container": "mkv",
                 "stream_container_decision": "direct play",
                 "stream_duration": "2998272",
                 "stream_subtitle_codec": "",
                 "stream_subtitle_container": "",
                 "stream_subtitle_decision": "",
                 "stream_subtitle_forced": 0,
                 "stream_subtitle_format": "",
                 "stream_subtitle_language": "",
                 "stream_subtitle_language_code": "",
                 "stream_subtitle_location": "",
                 "stream_video_bit_depth": "8",
                 "stream_video_bitrate": "10233",
                 "stream_video_codec": "h264",
                 "stream_video_codec_level": "41",
                 "stream_video_decision": "direct play",
                 "stream_video_framerate": "24p",
                 "stream_video_height": "1078",
                 "stream_video_language": "",
                 "stream_video_language_code": "",
                 "stream_video_ref_frames": "4",
                 "stream_video_resolution": "1080",
                 "stream_video_width": "1920",
                 "studio": "HBO",
                 "subtitle_codec": "",
                 "subtitle_container": "",
                 "subtitle_decision": "",
                 "subtitle_forced": 0,
                 "subtitle_format": "",
                 "subtitle_language": "",
                 "subtitle_language_code": "",
                 "subtitle_location": "",
                 "subtitles": 0,
                 "summary": "Jon Snow is dead. Daenerys meets a strong man. Cersei sees her daughter again.",
                 "synced_version": 0,
                 "synced_version_profile": "",
                 "tagline": "",
                 "throttled": "0",
                 "thumb": "/library/metadata/153037/thumb/1503889207",
                 "title": "The Red Woman",
                 "transcode_audio_channels": "",
                 "transcode_audio_codec": "",
                 "transcode_container": "",
                 "transcode_decision": "direct play",
                 "transcode_height": "",
                 "transcode_hw_decode": "",
                 "transcode_hw_decode_title": "",
                 "transcode_hw_decoding": 0,
                 "transcode_hw_encode": "",
                 "transcode_hw_encode_title": "",
                 "transcode_hw_encoding": 0,
                 "transcode_hw_full_pipeline": 0,
                 "transcode_hw_requested": 0,
                 "transcode_key": "",
                 "transcode_progress": 0,
                 "transcode_protocol": "",
                 "transcode_speed": "",
                 "transcode_throttled": 0,
                 "transcode_video_codec": "",
                 "transcode_width": "",
                 "type": "",
                 "updated_at": "1503889207",
                 "user": "LordCommanderSnow",
                 "user_id": 133788,
                 "user_rating": "",
                 "user_thumb": "https://plex.tv/users/k10w42309cynaopq/avatar",
                 "username": "LordCommanderSnow",
                 "video_bit_depth": "8",
                 "video_bitrate": "10233",
                 "video_codec": "h264",
                 "video_codec_level": "41",
                 "video_decision": "direct play",
                 "video_frame_rate": "23.976",
                 "video_framerate": "24p",
                 "video_height": "1078",
                 "video_language": "",
                 "video_language_code": "",
                 "video_profile": "high",
                 "video_ref_frames": "4",
                 "video_resolution": "1080",
                 "video_width": "1920",
                 "view_offset": "1000",
                 "width": "1920",
                 "writers": [
                     "David Benioff",
                     "D. B. Weiss"
                 ],
                 "year": "2016"
             }
         ],
         "stream_count": "1",
         "stream_count_direct_play": 1,
         "stream_count_direct_stream": 0,
         "stream_count_transcode": 0,
         "total_bandwidth": 25318,
         "wan_bandwidth": 0
         }

api json prtg

Created on Nov 6, 2018 9:32:42 PM

Last change on Nov 7, 2018 4:22:10 AM by  Benjamin Day [Paessler Support] (1,441) 2 1



1 Reply

Votes:

0

Bosse,

At this time we can only work with integer and float values. String results are converted into numbers. So if you're just looking to track metrics for Plex in terms of usage, and are OK with it returning the unique ID for the media asset, then it could work just fine for you. Here is more information on our REST Sensor.

Benjamin Day
Paessler Support

Created on Nov 7, 2018 4:28:57 AM by  Benjamin Day [Paessler Support] (1,441) 2 1




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.