NetXMS Support Forum

English Support => General Support => Topic started by: MarcusH on October 21, 2025, 03:59:38 PM

Title: Agent action encode
Post by: MarcusH on 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?
Title: Re: Agent action encode
Post by: Filipp Sudanov on 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?
Title: Re: Agent action encode
Post by: MarcusH on October 22, 2025, 08:36:51 AM
#!/bin/sh
# /agent/script/ping.sh
LOG=/agent/script/logs
mkdir -p "$LOG"

TS="$(date -u +%Y%m%dT%H%M%SZ)"
{
  echo "----- $TS -----"
  echo "PWD: $(pwd)"
  echo "USER: $(id)"
  echo "ARGV_STR: $*"
} >> "$LOG/ping.txt"

printf '%s\n' "$@" | od -An -t x1 >> "$LOG/ping-bytes.hex" 2>/dev/null || true

i tried Action=debug:echo "$1" >> /agent/script/a.txt also to have it as simple as possible and
$node.executeAgentCommand("debug","test") creates a.txt containing test
$node.executeAgentCommand("debug","testå") does not create a.txt, not error in agent log just "Execution of external action debug (echo "testå" >> /agent/script/a.txt) started"

If i run echo "testå" >> /agent/script/a.txt manually in same docker agent is running a.txt is created as utf8 and containing testå
Title: Re: Agent action encode
Post by: MarcusH on October 22, 2025, 09:15:38 AM
Tested with agent running on full debian 12 VM and no issue with åäö in action making this something with my docker setup it seems like.

it is the official docker setup from github though, will see if i have messed something up.
Title: Re: Agent action encode
Post by: MarcusH on October 22, 2025, 09:31:56 AM
Found the issue, docker ran with POSIX had to add

ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

Now it works with åäö