# System Function for pinging an IP through script

**URL:** <https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [April 13, 2022, 7:03am UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402 "2022-04-13T07:03:39Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sri\_Haran](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Sri\_Haran](https://forum.inductiveautomation.com/u/Sri_Haran)\
**Post date:** [April 13, 2022, 7:03am UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/1 "2022-04-13T07:03:39Z")

</div>

Hi,  
I’m in need of to update a numeric text field value by pinging a IP address that have in my DB  
So is there any function for that in ignition or anyone can give me your advice  
Thanks in Advance,  
Regards,  
Sri

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 13, 2022, 8:14am UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/2 "2022-04-13T08:14:09Z")

</div>

There are three projects on the Ignition Exchange that might be relevant.

Network Device Ping UDT by: Arnaud De Clerck

> **[Ignition Exchange](https://www.inductiveautomation.com/exchange/2235/overview)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.

Network Device Status by: Bao Nguyen

> **[Ignition Exchange](https://www.inductiveautomation.com/exchange/2192/overview)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.

Linux Network Device Ping UDT by: Michael Flagler.

> **[Ignition Exchange](https://www.inductiveautomation.com/exchange/2248/overview)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.

---

<div class="post-metadata">

**Author:** ![Sri\_Haran](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Sri\_Haran](https://forum.inductiveautomation.com/u/Sri_Haran)\
**Post date:** [April 13, 2022, 11:14am UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/3 "2022-04-13T11:14:15Z")

</div>

Thanks @Transistor  
But can i have a detailed explanation of this  
Regards,  
Sri

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 13, 2022, 11:37am UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/4 "2022-04-13T11:37:03Z")

</div>

There is usually documentation with each Exchange project - both on the Exchange pages and in the download. You load it onto your gateway and launch the application. If it does what you want then you import it into your own project.

If you have a particular question then explain what you have done and where you are stuck.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 13, 2022, 12:14pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/5 "2022-04-13T12:14:53Z")

</div>

If it's just strictly pinging you can check this out

> [@Script to ping computer](https://forum.inductiveautomation.com/t/script-to-ping-computer/16612/10):
>
> Shelling out for this makes me feel very icky, especially when Java already has the native ability to do this and that’s an invitation to accidentally send horrible things to the command line. Why not just: def ping(address,timeout=2000): from java.net import InetAddress ip = InetAddress.getByName(address) return ip.isReachable(timeout) This will throw UnknownHostException if the host can’t be looked up, or IOException if the network is broken, so you can handle that case as well, instead o…

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [April 13, 2022, 12:28pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/6 "2022-04-13T12:28:47Z")

</div>

Im not sure if any of these ping from the client to the address…  
but they proabbly ping from the gateway.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 13, 2022, 12:31pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/7 "2022-04-13T12:31:22Z")

</div>

Oh just noticed this is perspective. Yea all the jython runs on the gateway, so if you had a button that called the ping script in a view, it would be the gateway that ended up doing it, no matter what client clicked it.

If it’s just for checking to see if stuff is alive as a status check though that’s probably fine I would guess.

---

<div class="post-metadata">

**Author:** ![jkelleyus](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jkelleyus](https://forum.inductiveautomation.com/u/jkelleyus)\
**Post date:** [February 21, 2025, 6:27pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/8 "2025-02-21T18:27:50Z")

</div>

I'm late to the thread but wanted to revive it. We have several devices here we'd like to periodically ping which are not PLC's so I can't use the normal handshake methods.

I've tried the various Jython calls and while this also makes me queasy shelling out to it, it doesn't work when there's no path to the device (eg Windows "Destination not reachable" returns).

I've looked at several Exchange options and it appears that  
Arnuald De Clerk's solution might fit for the bill but the instructions are for the Maker Addition and I'm not sure if I can use it on standard Ignition.

I've worked with support on this and they are a little stumped, pointing me back toward our network people. I'm not sure that's helpful because I want to know if the device is offline irregardless of whether a device gateway is set incorrectly or any other reason.

Any more recent suggestions on how to do this with Ignition 8.1.44?

Thanks!!!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 21, 2025, 6:36pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/9 "2025-02-21T18:36:49Z")

</div>

Follow Tyler's instructions here:

> [@Script to ping computer](https://forum.inductiveautomation.com/t/script-to-ping-computer/16612/19):
>
> Here is a lengthy recap of the steps that lead to success in using java.net (InetAddress, isReachable) on a Linux server (Ubuntu 20.04.5 LTS) with Ignition running as a non-root system user account. Ran this command... sudo systemctl edit Ignition-Gateway.service Added this text... then saved changes. [Service] AmbientCapabilities=CAP\_NET\_RAW CAP\_NET\_BIND\_SERVICE Restarted the Ignition gateway... sudo /usr/local/bin/ignition/gwcmd.sh -r Confirmed the service was running without err…

I highly recommend **not** shelling out to the system's `ping` executable.

---

<div class="post-metadata">

**Author:** ![jkelleyus](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jkelleyus](https://forum.inductiveautomation.com/u/jkelleyus)\
**Post date:** [February 21, 2025, 6:39pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/10 "2025-02-21T18:39:25Z")

</div>

Thanks Phil. I've seen you reply this way before and appreciate your wisdom.

Do Tyler's instructions also work with Windows-based Ignition servers?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 21, 2025, 6:56pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/11 "2025-02-21T18:56:33Z")

</div>

> [@jkelleyus](#):
>
> with Windows-based Ignition servers?

Oy! No, Windows apparently doesn't have an ICMP system call even for admins, and java won't even try. The `ping` executable in windows creates raw ethernet packets of the right format.

The `ping` executable in both Windows and Linux is marked to have the necessary permissions to use raw packets. The `CAP_NET_RAW` setting in Linux gives this permission to non-root java so `.isReachable()` works properly.

Sorry. You'll have to use one of the options that calls an external program that has necessary permissions.

Chalk this up as just one more reason for my declarations that deploying Windows in plant floor applications is [engineering malpractice](https://forum.inductiveautomation.com/search?q=%40pturmel%20malpractice%20order%3Alatest).

---

<div class="post-metadata">

**Author:** ![jkelleyus](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jkelleyus](https://forum.inductiveautomation.com/u/jkelleyus)\
**Post date:** [February 21, 2025, 7:10pm UTC](https://forum.inductiveautomation.com/t/system-function-for-pinging-an-ip-through-script/58402/12 "2025-02-21T19:10:25Z")

</div>

I'd agree on Windows, but I have to deal the cards I'm dealt. Not many IT folks these days on the corporate level know much about 'Nix and refuse to allow its use. I sharpened my teeth on various Unix versions clear back to DEC PDP's (which were pretty fantastic with that tiny amount of processing power compared to today).

Sigh....
