New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


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

Votes:

0

Your Vote:

Up

Down

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 by  Sascha Lewandowski (2,291) 3 4



2 Replies

Accepted Answer

Votes:

8

Your Vote:

Up

Down

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: http://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 by  Sascha Lewandowski (2,291) 3 4

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



Votes:

0

Your Vote:

Up

Down

Great post! Thanks so much for sharing :D

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



Please log in or register to enter your reply.


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.