How to implement Ping Script via Gateway Timer Script > Multiple Devices

Below is a dev script running on a Control Logix, still fairly new to Ignition was needing feedback from experienced folks. Would like to create a gateway timer script to read/write to OPC tag to coms drop locally and raise server alarm.

type or paste code h# OPC Server and Tag Paths
opcServer = "Ignition OPC-UA Server"
itemPath = "ns=1;s=[AFSPL1RtRepair]OPC.Ping"
tag_path = "[Default]OPC/Assembly/L1/RTRPR/Ping"

isAlarmLogged = system.tag.readBlocking(['[Default]OPC/Assembly/L1/RTRPR/isAlarmLogged'])[0].value
isErrorLogged = system.tag.readBlocking(['[Default]OPC/Assembly/L1/RTRPR/isErrorLogged'])[0].value 
system.tag.writeBlocking(['[Default]OPC/Assembly/L1/RTRPR/isErrorLogged'], [False])

try:
    # Read the tag value and quality
    value = system.tag.readBlocking([tag_path])[0]
    tagValue = value.value
    tagQuality = value.quality

    # Check if the tag quality is good
    if tagQuality.isGood():
        if tagValue == True:
            writeOperationStatus = system.opc.writeValue(opcServer, itemPath, 0)
            if writeOperationStatus.isGood():
                pass  # Successful OPC Write 0
        else:
            writeOperationStatus = system.opc.writeValue(opcServer, itemPath, 1)
            if writeOperationStatus.isGood():
                pass  # Successful OPC Write 1
        # Reset active flags to False after a successful tag read/write operation
        if isAlarmLogged:
            system.tag.writeBlocking(['[Default]OPC/Assembly/L1/RTRPR/isAlarmLogged'], [False])
        
    else:
        # If "QUALITY IS BAD" 
        if isAlarmLogged == False:
            system.util.getLogger("L1RtRepair_PingQuality").error("BadQuality=[Default]OPC/Assembly/L1/RTRPR/Ping.Quality")
            system.tag.writeBlocking(['[Default]OPC/Assembly/L1/RTRPR/isAlarmLogged'], [True])

except Exception as e:
    # Log exception definiton defined by Igniton
    if not isErrorLogged:
       system.util.getLogger("L1RtRepair_Exception").error("Alarm: %s" % e) 
       system.tag.writeBlocking(['[Default]OPC/Assembly/L1/RTRPR/isErrorLogged'], [True])
       
       
     ere

You might be reinventing the whale here. Have a look at Network Device Status by: Bao Nguyen available to download on the Ignition Exchange.

I think there was another one as well but I can't seem to find it right now.

My main concern is when creating a timer script for each device I don't want to introduce any potential network issues. The ping is for the device to monitor for a local shutdown.

You would never create a timer script. You would use a gateway scheduled event.

You can also monitor any device's OPC status. Create a new tag with Value Source: OPC, Data Type: Boolean.

I haven't played with this for a while. You may need to monitor and see that it behaves in a fashion suitable for your purposes.

If using a ping to monitor heartbeat in PLC why would why would use gateway scheduled event vs gateway timer event?