Update SQL when thresshold is activated
-
Good day
I want to update a MSSQL database whenever a threshold is being hit.
Is this at all possible? If not. Can i update the MySQL database?
I want to insert a line into a table i created with specific values each time a threshold is reached.
Regards
-
-
By request here is more in detail
Under event configuration i have setup events named Alarm for all the severity levels the message is what you see in the alarm browser.
Event policy is set to execute xmpp and action snd_alert on these events
The action then runs command on the node via the agent and what the action sends to the node agent is returned by the script snd_alertsnd_script:
body = "snd_alert"; if ($event->parameters[2] == "SQLServer:General Statistics: Processes blocked") { body .= " sql_locked"; if ((localtime()->hour == 13) && (localtime()->min < 15)) { body .= " delivery_journal"; } } if ($event->parameters[2] == "SQL Deadlock") { body .= " sql_deadlock"; } if ($event->parameters[2] == "MD5 hash check for unchanged file") { body .= " breadcrumb_files"; } return body;In the agent configuration is:
ActionShellExec=snd_alert:/alert_sound/alert.sh $1 $2Scenario:
On the DCI named SQL Deadlock there is a threshold that triggers if the polled value is greater then 3.
This triggers the Alarm Major severity
The policy on Alarm Major triggers the action snd_alert
The action snd_alert runs script snd_alert
The script has statement for SQL Deadlock and the return string will be "snd_alert sql_deadlock"
The first value is the action to run on the node agent "snd_alert" the second value is the first parameter
The agent will then run: "/alert_sound/alert.sh sql_deadlock"For me this runs a wave file named sql_deadlock on the dashboard TV and inserts the event in a local db
You can add more parameters by adding $3 $4 etc on the action and returning more values via the script.
Helpful links
https://wiki.netxms.org/wiki/Main_Page
https://wiki.netxms.org/wiki/Scripting_Guide




Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login