My motive is to trigger an alarm pipeline in case my database connection status is getting faulted.
I can go to system gateway tags and configure alarm under each database connection I have done till now but I am trying to find way to dynamically configure an alarm whenever a new database connection is added.
Any way I can achieve this ?
You could create a script on the gateway that runs a tag report then loop through the results looking for False on the status and do any alarming you want.
Or put them in an array and trigger on any of them being False, etc etc
The tag report in a script would look like:
provider = 'System'
limit = 100
query = {
"options": {
"includeUdtMembers": False,
"includeUdtDefinitions": False
},
"condition": {
"path": "Gateway/Database*",
"attributes": {
"values": [],
"requireAll": True
},
"properties": {
"op": "Or",
"conditions": [
{
"op": "And",
"conditions": [
{
"prop": "name",
"comp": "Like",
"value": "Available"
}
]
}
]
}
},
"returnProperties": [
"tagType"
]
}
# Limited to 100 rows. Use continuationPoint functionality to continue from last result,
# or remove limit for full results.
results = system.tag.query(provider, query, limit)