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

[How-To] Display PRTG Information on Mac/Linux Desktop with PRTG API

Votes:

0

How can you display the Information of PRTG on your Desktop if you are using MacOS or Linux.

Is this possible and how can this be done?

api desktop linux mac prtg system

Created on Dec 15, 2014 10:32:37 AM



2 Replies

Accepted Answer

Votes:

8

Each of the systems need a special tool to display this information. On Mac OS you can use „Geeklets“ it is free and easy to install. On Linux you can use „conky“.

Both tools are easy to use with a big community behind. To display values on your desktop you have to do a couple of things on your PRTG.

This is maybe not best practise, but for me it is the easiest way to handle.

  1. Create a new User in PRTG (maybe name him “monitor“)
  2. give him rights to see all the sensors
  3. test it by passing this URL to your browser, if you get information, you are right ;) ('https://<<PRTG-Server-Name>>/api/getstatus.htm?id=0&username=<<username / monitor>> &password=<<password>> )

Till now the tutorial is only for Mac OS, but you can use this „snippet“ to conky on linux, too.

Create a new „Shell“ object and take him this command:

#!/bin/bash

getapi=$(curl 'https:// ://<<PRTG-Server-Name>>/api/getstatus.htm?id=0&username=<<username / monitor>> &password=<<password>>')

NewAlarms=$( echo $getapi | sed -e 's/[{}]/''/g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | grep "NewAlarms" | awk '{print $2}' | awk -F'[""]' '{print $2}')


if [ $NewAlarms -ne "0" ]; then
NewAlarms=$(printf "\e[41mNeue Alarme: "$NewAlarms)
echo -e $NewAlarms "\033[0m"
else
NewAlarms=$(printf "Neue Alarme: "$NewAlarms)
echo -e $NewAlarms "\033[0m"
fi

Fill out the information in the „<<>>“ ;).

First you will get the JSON-Object from PRTG-API. Than you form the object to the value you need (yes this could be easier, but this is how to understand the way ;)). With „grep“ we will match the line we want to get (in this example „NewAlarms“) and take it to the „If-Else“. If the value is „-ne“ (not equal) to „0“ than the Sensor is grey without warn status. If the value didn’t matches, than the output is red with warning.

You can do it with every value you want. API-Documentation: https://www.paessler.com/manuals/prtg/application_programming_interface_api_definition

Example:

PRTG-Destopinformation

Maybe this was helpful to you ☺

Best

Sascha

Created on Dec 15, 2014 11:49:19 AM

Last change on Dec 15, 2014 12:07:33 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Great post! Thanks so much for sharing :D

Created on Dec 15, 2014 12:14:51 PM by  Greg Campion [Paessler Support]




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.