News:

We really need your input in this questionnaire

Main Menu
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 - Victor Kirhenshtein

#1156
General Support / Re: help with aggregate DCI
September 16, 2019, 04:52:57 PM
Quote from: Egert143 on September 16, 2019, 02:03:33 PM
When i use "if (dci->name like "*{instance}") continue;" it doesent match.

Please share full script code. I checked on my system and it works as expected.

Best regards,
Victor
#1157
General Support / Re: help with aggregate DCI
September 16, 2019, 10:56:01 AM
You can do something like

for (dci : FindAllDCIs($node, ".1.3.6.1.2.1.25.3.3.1.2.*"))
{
   if (dci->name like "*{instance}")
      continue;
   // your code here
}


Best regards,
Victor
#1158
General Support / Re: Error libpcre32 on CentOS 6
September 16, 2019, 10:53:47 AM
Hi,

you have to manually install newer libpcre and configure it with libpcre32 enabled. You can use this version: https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz and configure it as following:

./configure --prefix=/opt/pcre --disable-static --disable-dependency-tracking --enable-pcre16 --enable-pcre32 --disable-cpp --enable-utf --enable-unicode-properties --disable-stack-for-recursion

It will install correct pcre into /opt/pcre (you can choose different prefix of course). Then add option --with-pcre=/opt/pcre to NetXMS configure.

Best regards,
Victor
#1159
Зарегистрировал как баг (https://track.radensolutions.com/issue/NX-1676), попробуем повторить у себя.
#1160
General Support / Re: help with aggregate DCI
September 15, 2019, 06:21:02 PM
Hi,

yes, script is valid, but you have to remember that it search DCIs by name (parameter name). Are you sure you have parameter names Cpu 1, etc. and not DCI descriptions?

Best regards,
Victor
#1161
Announcements / Re: NetXMS 3.0 released
September 15, 2019, 06:11:24 PM
Hi,

there are issues with libraries needed by 3.0 in Debian Jessie and so far we have no plans to provide Debian Jessie packages for version 3.0.

Best regards,
Victor
#1162
Announcements / Re: NetXMS 3.0 released
September 13, 2019, 12:51:16 AM
Hi,

I've found bug in Windows installer. Try to rename directory C:\NetXMS\lib\ncd to C:\NetXMS\lib\ncdrv and restart NetXMS Core service.

Best regards,
Victor
#1163
General Support / Re: Nxshell no longer working
September 12, 2019, 10:08:00 PM
Sorry, I was distracted by reflective access warnings and didn't notice actual method name. It was renamed to getAllChildren. We will upload javadocs for 2.2.17 and 3.0 in next few days.

Best regards,
Victor
#1164
Hi,

everything is correct. Raw value is in bytes, so if you want it in bits it should be multiplied by 8 (if you got 1 from device that means 1 byte, multiplying it by 8 gives 8, which is correct number of bits).

Best regards,
Victor
#1165
General Support / Re: Agent package for Ubuntu 19.04
September 12, 2019, 05:41:27 PM
Yes, we will publish packages for Ubuntu 19 in a few days.

Best regards,
Victor
#1166
Announcements / Re: NetXMS 3.0 released
September 12, 2019, 03:35:08 PM
Quote from: tomaskir on September 12, 2019, 12:11:15 PM
Quote from: Victor Kirhenshtein on September 12, 2019, 11:10:31 AM
That's complicated issue. Current implementation is a bit messy with $n variables after matching. Consider the following code:

v = "error 43";
if (v ~= "(error|warning) ([0-9]+)")
println("Step 1: $1=".$1." $2=".$2);
if (v ~= "(error .*|info ([0-9]+))")
println("Step 2: $1=".$1." $2=".$2);


In NetXMS 2.2 $2 will be equal "43" on step 2, which is kind of misleading. It was because implementation in 2.2 silently skipping unmatched capture groups. Implementation in 3.0 resets all unused $n variables, which has side effect of clearing $1 if there were no capture groups at all. Looks like it was bad decision to use same names for capture groups and script arguments.

I want to gradually clean up inconsistencies in NXSL, and that could lead to break up of some things. I think that for now I can introduce server configuration variable (off by default) that will prevent resetting of unused capture group variables. Also I will introduce separated naming for script arguments and capture groups so scripts could be migrated over time to non-overlapping variable naming. Also for transformation scripts I think it is worth passing raw value not only as first argument to the script but also as global variable, like $rawValue.

Best regards,
Victor

The problem here is that there are likely thousands of scripts all around the Forums, Wiki and the internet that this change breaks.
Every single one would have to be updated - which is unrealistic.
For new users who find some regex-based scripts on the internet, they will not work, and they don't know why.

Existing implementations (scripts) will start working differently upon upgrade, without any knowledge of the system operators
This will be VERY difficult to track down, as this will not produce script errors, rather things will just work differently.
This means there can be a threshold script which will "pretend" to still work, but in reality will not work.
It puts burden on system operators to review every script they have upon upgrade to check if it still works properly

What I personally would propose:
There are far less scripts using regex capture groups than just regex.
So if a change is needed, only regex capture group should be changed, without affecting regex operations without capture groups (as is the case now).

What about capturing regex returning arrays with captures?

matchArrray = "test" ~= "t(e)(s)t";

println(matchArrray [0] . matchArrray [1]);
for (match : matchArrray) {
  print(match);
}


This would clean up the reuse of $1, $2, etc. without breaking ALL regex handling.
The change would only affect a smaller part of community, so less impact.

I've changed regexp expressions to return array with capture groups instead of boolean value. It still sets $n variables for compatibility but does not erase unused variables (so if there is no capture groups in regexp $1 will be left intact). As a side effect it is now possible do directly access capture group from regexp. For example the following code

text = "error 43";
errorCode = (text ~= "error ([0-9]+)")[1];
println(errorCode);

will print 43.

Best regards,
Victor
#1167
You can simply use strftime (https://wiki.netxms.org/wiki/NXSL:strftime):

SetCustomAttribute($node, "timelastcameup", strftime("%d-%m-%Y, %H:%M:%S", $1));


Best regards,
Victor
#1168
Announcements / Re: NetXMS 3.0 released
September 12, 2019, 12:25:17 PM
Quote from: vir_db on September 12, 2019, 12:05:24 PM
Good morning.

just upraded to 3.0: more or less all hosts reports this alarm: Status of DCI xxxx (NetXMS Agent: sqlite-hosts) changed to UNSUPPORTED. (seems it comes from "Local Database" template)

just the server itself reports:

- Status of DCI 697 (Internal: Server.ThreadPool.Usage(SYNCER)) changed to UNSUPPORTED
- Status of DCI 696 (Internal: Server.ThreadPool.LoadAverage(SYNCER,1)) changed to UNSUPPORTED
- Status of DCI 695 (Internal: Server.ThreadPool.CurrSize(SYNCER)) changed to UNSUPPORTED
- Status of DCI 694 (Internal: Server.ThreadPool.Load(SYNCER)) changed to UNSUPPORTED

looking at Data Collection Configuration, those DCIs doesn't exists.

Also tried to delete the database (PGSQL) and have a fresh start, but the results is the same.

How can I solve?

thanks alot and best regards

You van safely ignore them. It is cosmetic issue in default templates, we will fix that in next patch release.

Best regards,
Victor
#1169
Announcements / Re: NetXMS 3.0 released
September 12, 2019, 11:10:31 AM
Quote from: tomaskir on September 12, 2019, 02:36:19 AM
Quote from: Tursiops on September 12, 2019, 02:16:29 AM
Just a practical note on this one:
Quote1. We have switched from TRE to PCRE as regular expression engine. In most cases this should go unnoticed, but in certain cases regular expressions may stop working or produce unexpected results.

A side effect of this change is that if you are matching a regular expression, even without a capture group, $1, $2, etc. will be reset to null values.
An transform script example of where that might cause an issue:
if ( $1 ~= "^Hello\s+World" ) {
  return $1;
} else {
  return "Something Else";
}


In prior versions of NetXMS, if the DCI returned "Hello World", the transform script would have returned exactly that.
With version 3, the transform script will return null.

You will need to change your script to something like this:
value = $1;
if ( value ~= "^Hello\s+World" ) {
  return value;
} else {
  return "Something Else";
}


Is this a known and expected change or a bug?
This will break A LOT of my NXSL scripts...

That's complicated issue. Current implementation is a bit messy with $n variables after matching. Consider the following code:

v = "error 43";
if (v ~= "(error|warning) ([0-9]+)")
println("Step 1: $1=".$1." $2=".$2);
if (v ~= "(error .*|info ([0-9]+))")
println("Step 2: $1=".$1." $2=".$2);


In NetXMS 2.2 $2 will be equal "43" on step 2, which is kind of misleading. It was because implementation in 2.2 silently skipping unmatched capture groups. Implementation in 3.0 resets all unused $n variables, which has side effect of clearing $1 if there were no capture groups at all. Looks like it was bad decision to use same names for capture groups and script arguments.

I want to gradually clean up inconsistencies in NXSL, and that could lead to break up of some things. I think that for now I can introduce server configuration variable (off by default) that will prevent resetting of unused capture group variables. Also I will introduce separated naming for script arguments and capture groups so scripts could be migrated over time to non-overlapping variable naming. Also for transformation scripts I think it is worth passing raw value not only as first argument to the script but also as global variable, like $rawValue.

Best regards,
Victor
#1170
Announcements / Re: NetXMS 3.0 released
September 12, 2019, 10:58:03 AM
Quote from: brettmilfos on September 12, 2019, 06:59:17 AM
Just upgraded and have found an issue with SMS.

It created the migrated notification channel but did not work.

I tried to create a new notification channel, but there is nothing to select in the Driver name drop down.

Thanks, Brett.

How did you install server? On what platform?

Best regards,
Victor