Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - MarcusH

#91
severity is the attribute, setSeverity is the method
#92
Announcements / Re: NetXMS 2.0.7 released
December 07, 2016, 10:20:16 AM
My head exploded with ideas when i read new function AgentExecuteAction, thank you so much for that been missing that.
#93
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_alert

snd_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 $2

Scenario:

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
#94
Hi,

I do it by threshold->event->action and under action run execute command on remote node via agent then on the sql node i have setup that action to run a file that updates sql with data provided from parameters.
#95
General Support / Re: same threshold on multiple dci
November 10, 2016, 12:04:32 PM
Found another problem in that it is loops newest value first so the check from oldvalue is wrong.
Is there any method for reversing arrays?

Experimenting with for loop with array size, though just reversing array using foreach would be nice
#96
General Support / Re: same threshold on multiple dci
November 10, 2016, 09:51:28 AM
oh my god that's just... i stared hours on that and was 110% sure i copy pasted everything and just changed event name.

Many thanks  :D
#97
General Support / Re: same threshold on multiple dci
November 09, 2016, 03:16:50 PM
Solved my problem with script, though i have one problem i can't seem to figure out

28 DCI with name starting with IntQ that collects data every 5 sec
1 DCI that runs the script every minute

What this script does is that it will trigger event and set alarm if any of the DCI values do not go down under 15 min (900sec)
and if values goes down and alarm exists trigger event to terminate alarm

MAIL_ALL event has create alarm with key ALARM-%1
MAIL_ALL_RESET event has terminate alarm with key ALARM-%1

The logic works it will trigger the events and create alarm correctly but the termination of the alarm in MAIL_ALL_RESET does not work and the alarm will remain, i can not see why this should not work.

Any help in this would be very appreciated.

foreach(adci : FindAllDCIs($node,"IntQ*"))
{
eventtrigger = 1;
oldval=0;

// Check DCI values if they are going down within time period.
foreach(dcivalue : GetDCIValues($node, adci->id, time() - 900, time()))
{
if((oldval > dcivalue) || (dcivalue == 0)){eventtrigger = 0;}
oldval = dcivalue;
}

alarm = FindAlarmByKey("ALARM-".adci->name);

// Trigger event, and set alarm so mail action is only triggered once.
if(eventtrigger == 1)
{
if(alarm == null)
{
PostEvent($node, "MAIL_ALL", null, adci->name, adci->description, null, GetDCIValue($node, adci->id));
}
}

// Reset event alarm
if(eventtrigger == 0)
{
if(alarm != null)
{
PostEvent($node, "MAIL_ALL_RESET", adci->name, adci->description, null, GetDCIValue($node, adci->id));
}
}
}


Edit: Even tried terminating alarm via method terminate still nothing.
#98
General Support / same threshold on multiple dci
October 31, 2016, 03:11:04 PM
Hi,

Is there any way to mass update thresholds like with templates?
I have alot of DCI that uses same threshold but each time this threshold needs to be tweaked i need to update each DCI one by one.
#99
General Support / Re: interface id on state change
October 17, 2016, 10:30:05 AM
Been trying to figure this out but every information i find states that parameters are passed as macro %5 or variable $5 in script.

macro %5 works in message but variable $5 is empty when calling script via macro in message is this bugged in any way, or might i be missing something crucial here?

Running version 2.0.5

Edit:
Found solution, change $5 to $event->parameters[5]
#100
That seems logical, though this external does not return data by itself it consolidates data in an external sql db for faster queries.
Can run it in windows schedule but felt more right to run it from the agent that uses it on set schedule.

The answer though solved a few other data collection dilemmas i had so thanks for that, time to rethink my data providers :)
#101
General Support / Re: interface id on state change
October 10, 2016, 12:35:18 PM
Many thanks for help with the script, i have tested it and i got it to work as intended and it is triggered as planed but $5 does not return anything so it fails.
If i change $5 to 1 manually as it is the iface i test on it works and the custom attribute is shown in the alert message.
#102
This is not the real file, i tested different scenarios and this test.exe is only a while loop so it stays active

[10-Oct-2016 11:01:16.251] [DEBUG] [session:0] Requesting parameter "test"
[10-Oct-2016 11:01:16.251] [DEBUG] H_ExternalParameter called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:16.251] [DEBUG] RunExternal called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:16.251] [DEBUG] RunExternal: command line is "c:\test.exe"
[10-Oct-2016 11:01:16.251] [DEBUG] RunExternal (shell exec): worker thread created
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal (shell exec): execution timeout
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal (shell exec): execution status 2
[10-Oct-2016 11:01:18.266] [DEBUG] [session:0] Requesting parameter "test"
[10-Oct-2016 11:01:18.266] [DEBUG] H_ExternalParameter called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal: command line is "c:\test.exe"
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal (shell exec): worker thread created
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal (shell exec): execution timeout
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal (shell exec): execution status 2
[10-Oct-2016 11:01:20.266] [DEBUG] [session:0] Requesting parameter "test"
[10-Oct-2016 11:01:20.266] [DEBUG] H_ExternalParameter called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal: command line is "c:\test.exe"
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal (shell exec): worker thread created
[10-Oct-2016 11:01:22.282] [DEBUG] RunExternal (shell exec): execution timeout
[10-Oct-2016 11:01:22.282] [DEBUG] RunExternal (shell exec): execution status 2
#103
Hi,

I have set up one node to run a file via ExternalParameterShellExec on the agent but when it executes the file it runs it 3 times, any known related problems to this?
Searched the bugtracker but could not find any.

Tested both forced DCI poll and scheduled.

Agent version 2.0.5
Windows 2012 R2
#104
Quote from: mclifford on September 19, 2016, 11:16:49 PM
I am running agent version 2.05-x64 and I am getting a returned value of 0 for the following.

\PhysicalDisk(1 E:)\Avg. Disk sec/Read
\PhysicalDisk(1 E:)\Avg. Disk sec/Write
\PhysicalDisk(1 E:)\Disk Reads/sec
\PhysicalDisk(1 E:)\Disk Writes/sec

If you haven't verify in windows using performance monitor on that machine that there actually are other values then 0, the counters usually don't save average values indefinitely hence returning 0 on low activity.
#105
General Support / interface id on state change
September 16, 2016, 01:00:13 PM
Hi,

I am monitoring all the ports on our switches to see if and when hardware is added or removed via the state change of the interface.
These are named after the portnumber so the alarm state for example "Interface "33" unexpectedly changed state..."

What is the best and most correct way to add alias to ports since i want to add room/local network alias to the interface port so i know where or who it is.
Change object name does not work since it updates when polling back to port number, change port name on the switch does not work it wont send that when snmp is polling.
Now i am looking into the custom attribute to set that and if you can use data from these in the alarm message, still trying to find info about how custom attributes are used though.

Any pointers would be appreciated.