Is there a way to ping an address with an expression? I have a few WAPs that I ould like to ping and get a boolean back.
There are a few ping utilities in the Ignition Exchange. Here's one:
cool ill check it out
So i downloaded the view and it works great. I want to go a tag route and downloaded/imported a udt:
When I try and use it i get an error saying it cannot execute the expression runScript("NetworkAnalysis.ping")
The script exists in the Scripting of the project:
I was curious if any suggestions on this?
scripts executed in a Tag Expression runScript()
must be located in the Gateway Scripting Project. If you have a Gateway Scripting Project then you should put the script there. If you don't already have one then you should configure one.
I see. Yes we do I just found it. That took care of it. thank you sir.
I've just response to your email with the same tips as @lrose give you.
Just as feedback, was it not clear enough in the installation steps on the exchange ressource? How can i made more clear for the next person using it?
Regards
That same email you sent me really cleared things up. The pics were most helpful. It's a great udt!
Oy! Someone share the pics.
I didn't mention the name of the Exchange project. To help with search indexing here it is.
I see lots of posts saying "don't use runScript!" from years ago, but this project uses it. Does that rule still apply? Or is there a more preferred way to use ping to monitor device status than in a fixed rate runScript from tags (Perspective)
Don't use runScript()
for this kind of task, particularly not in expression tags. If you need to monitor a list of target devices, use a timer event and write the results to memory tag(s).
Consider using java's built-in "ping" support via InetAddress.isReachable(). (On linux, this requires CAP_NET_RAW
.)
Thanks for confirming. The script does use the Java ping but it’s invoked by runscript. I’ll create a timer script instead so it’s also in one place.
I did notice the runscript will write to the tags even with comms off, convenient but potentially dangerous, but good for testing. Is there a way to have comms off as a global but allow certain tags to be written?
Comms control is a designer-specific function, not available nor meaningful in gateway scope.
Ah, yes, understood, thanks