Hi,
I would like to setup probes to ping our various locations. I would like each location to have an icon that pings (only). The icon should show me the ping time, and be GREEN when between 0-199, YELLOW when between 200-299, ORANGE 300-399, and RED 400-DOWN. Is there a way to configure my ping probe in this way?
Thanks in advance for any advice!
I don’t know if the colors are exposed to functions. I did make a latency function but you will find the dude ping is not accurate.
You could use 3 probes, one that is up if ping is less than 200, one that is up if ping is less than 400 and one that is down if ping is greater than 400. Then put all 3 probes on every device. Then the device will turn color based on up, partially down and completely down.
Here is code for the function and call it from a probe…
function
pingx
array_element(ping(device_property(“FirstAddress”)),0)
Probe error line
greenping
if (pingx < 200, “” , “high latency”)
yellowping
if (pingx < 400, “” , “higher latency”)
redping
if (pingx >= 400, “” , “highest latency”)
If somehow you figure out if/where the device color is exposed you could use that number to create the color and use the following code.
Create a function
latency
if(array_element(ping(device_property(“FirstAddress”)),0)<200,“Green”,
if(array_element(ping(device_property(“FirstAddress”)),0)<300,“Yellow”,
if(array_element(ping(device_property(“FirstAddress”)),0)<400,“Orange”,
if(array_element(ping(device_property(“FirstAddress”)),0)>=400,“Red”,
“No Response”
))))
Then put this on the device label or on the map settings for the label or on the global settings for the label.
[latency()]
If you figure out how to change color instead of returning the word for the color you could just put the code in.

Thanks for your reply Lebowski, I will dig deeper and see what I can figure out.
If anyone else has any ideas, would be much appreciated 
Is there a way to have it display the ping result in the map graphic?
Which method are you using? Three probes?
No just the one ping probe by itself. Just wondered how to make it display the ping result on the icon (as in, where you can go into the appearance and put what you want to see in the icon, there is nothing in the drop down to display ping result). I thought I had done this before but can’t find the code for it.
Just put [array_element(ping(device_property(“FirstAddress”)),0)] on the appearance of the label or on the map or global settings…
or
create a function and put the name in the label
function
NAME: latency2
CODE: array_element(ping(device_property(“FirstAddress”)),0)
Label
[latency2()]
Here is a screenshot to help…

That is exactly the code I was looking for (can’t believe I didn’t have this saved in my test Dude system). Thanks again for your help.
Still would love a way to create icons that would ping our snapgears at each location, and change colors as described above. But this will do for now. 