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

Is there a way to display the content of a file on a map ?

Votes:

0

Hello,

I am looking for a way to get the content of an txt File displayed on a map. The content of the file gets refreshed every 5 minutes.

A script-sensor doesn’t work for me, for every "new" line of data a new channel is created and the channel from a line that got replaced just gets a "no value" message instead of being deleted. In addition to that, I couldn´t find a way to sort the channels by their Value, from high to low.

This is the script I used

Write-output '<?xml version="1.0" encoding="Windows-1252" ?>'

Write-output '<prtg>'

$InputData = @(Get-Content C:\folder\file.txt)
foreach ($line in $inputData) {
$lineName = $line.SubString(3)
$lineNumber = $line.SubString(0,2)

Write-output '   <result>'
$channel ='      <channel>' + $lineName + '</channel>'
$value ="      <value>"+ $lineNumber + "</value>"
echo $channel
echo $value
Write-output '   </result>'
}

echo '   <text>Demo values. OS: %OS%^</text>'
echo '</prtg>'

My next approach was to display the whole TXT file with a Custom-HTML-Object here is what I tried:

(The "file.txt" is located on the PRTG-Server himself)

<iframe src='file://PRTGserver/c$/folder/file.txt'></iframe>

If I try to access file:PRTGserver/c$/folder/file.txt manually with a web-browser, it works great. I also tried to use "localhost" and the IP-Address. But in all three cases it doesn´t work with the Custom-HTML-Object.

Then I made the folder a network share with read permissions for everyone. I could verify that the network share worked as intended by opening the file from my own PC (with Web browser of cause). But again, it didn’t work with the Custom-HTML-Sensor. <iframe src='file://PRTGserver/folder/file.txt'></iframe>

Does someone either has another idea how I could display the file content or know what I must change to make my approaches work ?

Best regards, More

filecontent html maps prtg sensor shared-network-path

Created on Sep 11, 2020 12:45:48 PM

Last change on Sep 14, 2020 4:59:32 AM by  Marijan Horsky [Paessler Support]



Best Answer

Accepted Answer

Votes:

0

I took another look at the "iframe-solution".

I had to use an internal webserver to provide the File "info.txt" and I tried to display this file using <iframe src='http://Server-IP/info.txt'> </iframe> but it didn´t work at first. Then I read somewhere that I had to use https for iframe to work. After I enabled SSL on my Webserver I could Display the file using <iframe src='https://Server-IP/info.txt'> </iframe>

in order to change the size of the text I may use a HTML file instead of a TXT file.

Created on Oct 29, 2020 10:45:20 AM



8 Replies

Votes:

1

Hello,

Thank you for your post.

One way that may work is to use the script sensor, and have the text from the file appear in the sensor message instead of the channels. Then you can use a "Sensor (message only)" map object (from the "Status Icons" group) to display the entire sensor message.


Kind regards, Sasa Ignjatovic, Tech Support Team

Created on Sep 14, 2020 10:46:39 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Hello, thanks for the response. I did as you said and wrote the value to the channel message, looks good so far. But now I struggle to change the font size of my custom "only-message-sensor".

I read in the forms that I must use

style="font-size:48px"

to change the font size but wherever I tried to paste it in it wouldn’t work ...

This is the sensor-code:

!--Status Icons: Sensor message only-->
<div class="map_object map_icon2 map_icon_large mapicon_status_transparent" id="<@itemid>" objectid="<@objectid>" subid="<@subid>" style="<#mapobject type="coordinates" subid="<@subid>" mode="<@editmode>">
  <#mapobject type="objectgrip" mode="<@editmode>">
  <#mapobject type="htmlbefore" subid="<@subid>">
  <#checkobjecttype objecttype="sensor" nicemessage="true" id="<@objectid>">

  <div style="clear: both;"><#objectstatus name="message" show="textraw" id="<@objectid>"></div>

  <#mapobject type="htmlafter" subid="<@subid>">
</div>

Created on Sep 21, 2020 10:52:32 AM

Last change on Sep 22, 2020 5:41:03 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Hello,

Please try the solution mentioned in this article.

Created on Sep 22, 2020 6:36:13 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Hi,

unfortunately, the solution mentioned in this article doesn´t work for me.

i tried adding .customalarms_biggerfont td { font-size: 30px !important; }

to the styles_custom.css (which was blank)

This is the Sensor Code I used:

<!--Status Icons: Sensor message only-->
<div class="map_object map_icon2 map_icon_large mapicon_status_transparent customalarms_biggerfont" id="<@itemid>" objectid="<@objectid>" subid="<@subid>" style="<#mapobject type="coordinates" subid="<@subid>" mode="<@editmode>">">
  <#mapobject type="objectgrip" mode="<@editmode>">
  <#mapobject type="htmlbefore" subid="<@subid>">
  <#checkobjecttype objecttype="sensor" nicemessage="true" id="<@objectid>">

  <div style="clear: both;"><#objectstatus name="message" show="textraw" id="<@objectid>" ></div>

  <#mapobject type="htmlafter" subid="<@subid>">
</div>

I also tried adding .customalarms_biggerfont td { font-size: 30px !important; }

to the styles_custom_v2.css, which I already use to customize the color of another Sensor

/*
//        You can use this file to modify the appearance of the PRTG web interface
//        as described in https://kb.paessler.com/en/topic/33
//        
//        Please note that you are using an unsupported and deprecated feature. 
//        Your changes will be broken or removed with future PRTG updates.
//        
//        If you modify this file, PLEASE LET US KNOW what you're changing and why!
//        Just drop an email to [email protected] and help us understand your 
//        needs. Thank you!       
*/
.map_object.map_customcolor_senso,.map_object.map_customcolor_senso label,.map_object.map_customcolor_senso span,
.map_object.map_customcolor_sensr,.map_object.map_customcolor_sensr label,.map_object.map_customcolor_sensr span,
.map_object.map_customcolor_sensq,.map_object.map_customcolor_sensq label,.map_object.map_customcolor_sensq span {
background-color: <#colorcode color="statusdown">;
color: #fff;
}
.map_object.map_icon2.map_customcolor_sensg,.map_object.map_icon2.map_customcolor_sensg label,.map_object.map_icon2.map_customcolor_sensg span {
background-color: <#colorcode color="statusup">;
}
.map_object.map_customcolor_sensy,.map_object.map_customcolor_sensy label,.map_object.map_customcolor_sensy span {
background-color: <#colorcode color="statuswarning">;
}
.map_object.map_customcolor_sensb,.map_object.map_customcolor_sensb label,.map_object.map_customcolor_sensb span {
background-color: <#colorcode color="statuspaused">;
}
.map_object.map_customcolor_sensp,.map_object.map_customcolor_sensp label,.map_object.map_customcolor_sensp span {
background-color: <#colorcode color="statusunusual">;
}
.map_object.map_customcolor_sensx,.map_object.map_customcolor_sensx label,.map_object.map_customcolor_sensx span {
background-color: <#colorcode color="statusunknown">;
color: #fff;
}
.map_object.map_customcolor_hasblack {
background-color: #ddd;
}
.map_object.map_customcolor_hasgreen {
background-color: #b8c419;
}
.map_object.map_customcolor_hasblue {
background-color: #b8c419;
}
.map_object.map_customcolor_hasorange {
background-color: #b8c419;
}
.map_object.map_customcolor_hasyellow {
background-color: #b8c419;
}
.map_customcolor_hasred,.map_customcolor_haspartialred,.map_customcolor_hasredok {
background-color: #e30613 !important;
}
.customalarms_biggerfont {
    font-size: 48px !important;
}

but this change also didn´t have any effect. Even a Server restart, which was required to make the color change take effect back then, didn´t help.

Any idea what’s wrong?

Created on Sep 30, 2020 9:12:55 AM



Votes:

0

I have looked into this a bit further, and it seems that you can't increase the font for map objects that have a fixed size. This does work for map object for which you can change the size (like for the "Data Tables" objects).

Created on Oct 1, 2020 7:08:33 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

ok, so unfortunately without the ability to resize the text I need another solution, any ideas ?

Created on Oct 5, 2020 2:19:10 PM



Votes:

0

Hello,

I'm afraid that the map editor is a little bit limited regarding this matter. Nevertheless, I found an other KB article which may help you: https://kb.paessler.com/en/topic/62000-values-only-on-maps

I'm afraid that we can't provide further support for advanced customizations.

Kind regards.

Created on Oct 6, 2020 12:36:19 PM by  Florian Lesage [Paessler Support]



Accepted Answer

Votes:

0

I took another look at the "iframe-solution".

I had to use an internal webserver to provide the File "info.txt" and I tried to display this file using <iframe src='http://Server-IP/info.txt'> </iframe> but it didn´t work at first. Then I read somewhere that I had to use https for iframe to work. After I enabled SSL on my Webserver I could Display the file using <iframe src='https://Server-IP/info.txt'> </iframe>

in order to change the size of the text I may use a HTML file instead of a TXT file.

Created on Oct 29, 2020 10:45:20 AM




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.