Recent posts

#11
General Support / Re: Sending alarms to N8N?
Last post by Alex Kirhenshtein - October 21, 2025, 11:16:19 PM
also you don't need "function main()", just write code.

something like this:

source = FindObject($alarm.sourceObject());

j = JsonObject();
j.set("id", $alarm.id);
j.set("state", $alarm.state);
j.set("severity", $alarm.severity);
j.set("message", $alarm.message);
j.set("source", source ? source.name : "");
j.set("eventCode", $alarm.eventCode);
j.set("eventName", $alarm.eventName);

trace(0, j.serialize());

I highly recommend you to read https://www.netxms.org/documentation/nxsl-latest/.
#12
General Support / Re: Sending alarms to N8N?
Last post by Alex Kirhenshtein - October 21, 2025, 10:22:34 PM
There are no "Execute()" function in the NXSL, and you can't execute external commands in any way - that's by design.

What I'd do:
- create Action which runs external shell script to form  json and send query using curl. Pass required event fields as arguments to the script.
- add this Action to EPP (I'd create separate rule just for this integration - this way you can control what exactly being sent)

Or, you setup web service (Settings -> Web service definition), and call it from NXSL. But again, I'd use action for that, not hook.

Note on the json string escaping: instead of manual processing, you can use construct https://netxms.org/documentation/nxsl-latest/#class-jsonobject and produce perfectly valid json.
#13
General Support / Re: Sending alarms to N8N?
Last post by Sorikan - October 21, 2025, 10:03:11 PM
I tried doing something like this, but kept hitting various walls, when using hook::alarmstatechange

function main()
{
   webhook = "https://my.host.hstgr.cloud/webhook-test/netxms-alarm";

   payload = "{"
      + "\"id\":\""        + ToString($alarm->id) + "\","
      + "\"state\":\""     + ToString($alarm->state) + "\","
      + "\"severity\":\""  + ToString($alarm->severity) + "\","
      + "\"message\":\""   + EscapeString(($alarm->message != null) ? $alarm->message : "") + "\","
      + "\"source\":\""    + (($alarm->sourceObject != null) ? EscapeString($alarm->sourceObject->name) : "") + "\","
      + "\"eventCode\":\"" + ToString($alarm->eventCode) + "\","
      + "\"eventName\":\"" + EscapeString(($alarm->eventName != null) ? $alarm->eventName : "") + "\""
      + "}";

   WriteLog(0, "Alarm JSON: " + payload);

   cmd = "curl -s -X POST -H 'Content-Type: application/json' -d '" + payload + "' " + webhook;
   Execute(cmd);
}

function EscapeString(s)
{
   if (s == null)
      return "";
   s = Replace(s, "\\", "\\\\");   
   s = Replace(s, "\"", "\\\"");   
   return s;
}


#14
General Support / Re: Agent action encode
Last post by Filipp Sudanov - October 21, 2025, 05:16:11 PM
Something as simple as
Action=debug:echo "$1" >> /tmp/a.txt
works for me with these letters. But I did not try in Docker, can you check if this works there?

Can you show your ping.sh script?
#15
General Support / Agent action encode
Last post by MarcusH - October 21, 2025, 03:59:38 PM
Trying to create an action that runs a script but as soon as i have char åäö in parameter it seems like it fails to run the process, have agent in debuglevel 6 and no error shows up it runs process and it shows PID for it.

I have verified that everything i can think of is utf8

made debug script that logs to file if run Action=debug:/agent/script/ping.sh --message "$1"

$node.executeAgentCommand("debug","test") runs fine and log files are created
$node.executeAgentCommand("debug","testå") is executed according to agent log and gets PID but no logs are created and i can't figure any more deeper way to debug

Running agent 5.2.6 on Debian 12 in docker

if i run script in docker cli it works with åäö only fails when agent runs the script.

Any tips or known issues?
#16
General Support / Re: Grafana with Infinity and ...
Last post by MarcusH - October 21, 2025, 09:12:54 AM
I did that but after server restart everything got 401 unauthorized and i had to reissue token.
I see now that log states "New persistent authentication token issued for user grafana [10]" i guess something might be wrong with token save then.
#17
General Support / Re: Sending alarms to N8N?
Last post by Sorikan - October 20, 2025, 09:23:44 PM
Thats not really a thing? I am trying to get all of the alarm information I can into N8N. You can see the documentation in the link below. I had attempted to build the JSON in hook::AlarmStateChange, but that appears to be a dead end at this point? I am now trying to just dump the data to a script with a shell notification channel - but I am not getting any actual alarm data in the fields yet.

https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/#webhook-urls

Thanks.
#18
General Support / Re: Sending alarms to N8N?
Last post by Filipp Sudanov - October 20, 2025, 06:40:46 PM
Can you point me to n8n documentation on the api call you are trying to use
#19
General Support / Sending alarms to N8N?
Last post by Sorikan - October 20, 2025, 05:58:32 PM
Has anyone been able to come up with a way to send alarms to an N8N instance? I have tried Hook::AlarmStateChange, and a notification channel and nothing works. I was on 5.2.4 but upgraded to 5.2.6 to see if that opens anything up.

I have been hitting up Google and all the LLM's, to no avail.

I am attempting to sedn JSON from netxms to N8N.

Thanks!
#20
General Support / Re: Devices not being added af...
Last post by Filipp Sudanov - October 20, 2025, 04:20:17 PM
I've checked your initial message, do not truly understand what is meant by "linked the agent to a container in a zone".
Agent should be specified in Zone's properties on Communications page. Zones are found under "Entire network" (Network perspective).
From agent's side it's configuration should have
EnableProxy = yes
EnableSNMPProxy = yes

If issue still persist, please grep the log for 2-3 specific IP addresses so that we have full process for each of them.