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 - Filipp Sudanov

#706
Если запустить скрипт на ноде, то:

transport = $node->createSNMPTransport(); 
if (transport == null) exit;
value = transport->get(".1.3.6.1.2.1.25.3.5.1.2.1");
if (value == null) exit;
bytestream = value->getValueAsByteStream();
bytestream->seek(0);
println(bytestream->readByte());

bytestream->seek(xxx) позволяет указать, с какого байта мы хотим читать. При создании byte stream будет стоять на 0, так что bytestream->seek(0); делать и не нужно.

Тут мы прочитали один байт. Можно прочитать и сразу два:
println(bytestream->readUInt32B());
или
println(bytestream->readUInt32L());
смотря как они там идут - как Little Endian или Big Endian.

Ну и стоит проверить, что bytestream->size достаточной длины, чтоб в нем два байта поместилось.

Судя по описанию там каждый бит сообщает о каком-то состоянии. Нужен ли пример разбора по битам?



------

В документации bytestream не описан, будем потихоньку добавлять. Но информацию об NXSL классах можно добыть прямо в скрипте, это может помочь разобраться:

transport = $node->createSNMPTransport(); 
if (transport == null) exit;

value = transport->get(".1.3.6.1.2.1.25.3.5.1.2.1");
if (value == null) exit;

println("=========================================================");
println("Class: " . classof(value));
println("=== Attributes ===");
for(a : value->__class->attributes)
  println(a . " = " . value->__get(a));
println("=== Methods ===");
for(a : value->__class->methods)
  println(a);

bytestream = value->getValueAsByteStream();

println("=========================================================");
println("Class: " . classof(bytestream));
println("=== Attributes ===");
for(a : bytestream->__class->attributes)
  println(a . " = " . bytestream->__get(a));
println("=== Methods ===");
for(a : bytestream->__class->methods)
  println(a);

 
#707

Если они все живут непосредственно под этим контейнером (а не в подконтейнераз), то сделать в script library такой скрипт:

container = FindObject(1234);  // 1234 - ID контейнера

status_to_count = $ARGS[1];
count = 0;
for (c : container->children) {
  if (classof(c) == "Node") {
    if (status_to_count == -1 or c->status == status_to_count) count++;
  }
}
return count;





В качестве параметра скрипту подается число

0Normal
1Warning
2Minor
3Major
4Critical

или -1 - считать все ноды.

Ну и дальше на какой-нибудь ноде (для этих целей можно создать фиктивную ноду с адресом 0.0.0.0) сделать скриптовые DCI которые вызвают этот скрипт из библиотеки.
#708
General Support / Re: Agent Tables
December 14, 2022, 06:47:33 PM
Can you show your external table configuration in agent configuration file?
#709
Hi!

Actually, Condition objects are planned for removal in a future version, as there are now other options to do things.
Can you illustrate your use case, what exactly these conditions do and where they take the data?
#710
General Support / Re: NXMC database best practices
December 14, 2022, 06:43:27 PM
I'm not an expert in MariaDB, but here's a post that has a query, which should give some information from the DB about used and allocated disk space.
#711
What changes have you performed prior for this to happen? Did you upgrade NetXMS? From what version to what version (exactly)?
#712
General Support / Re: NXMC database best practices
December 12, 2022, 11:56:27 PM
First of all, it's a question of your retention times for DCIs and event, alarm, etc log retention times (search for "Retention" in Configuration->Server configuration). At some older version there was also a bug that some of these log tables were not cleared, so make sure that you are on the newest version.

Also, could it be that during the life of your system a lot of new nodes or new DCIs were added - that would also add up to the DB size.

According to retention settings housekeeper should delete records from the db. (It's also worth to check server log for any SQL errors - and there are events generated for such cases - make sure you've configured notifications for these events).

Then it's a question to the database engine that you are using - how effective it is in performing vacuum operation to reclaim space. Normally the database should keep at some size and not grow much. What DB engine are you using?
#713
In 4.2 support for TCP proxying was added into agent and desktop management client (and was not yet documented)

Agent should have EnableTCPProxy=yes in it's config

In management client it's done via Object Tools, there's "Setup TCP tunnel..." checkbox.
There are two macros - ${local-address} and ${local-port} which are replaced by actual local IP and port

So Local Command object tool with command
mstsc /v:${local-address}:${local-port}
should work for RDP
#714
General Support / Re: Dashboards disappeared
December 09, 2022, 03:30:00 PM
What exactly version of NetXMS do you have?
Could it be that your NetXMS got upgraded recently?
#715
General Support / Re: Move node between clusters?
November 30, 2022, 02:34:45 PM
If you have that node under some other container or template, you can remove it from cluster and then you can add it to another cluster (all done from cluster context menu).

By the way, how many clusters do you have in your system (just to understand the scale how people use clusters)

#716
Добавили еще обработку сетевых ошибок в драйвере Телеграмма, это пойдет в 4.3
#717
Something like this may happen right after server start, if you are taking values from a DCI that has quite frequent collection interval. In this case server is not getting last collected value from database, but awaits it from agent.
You can check if GetDCIRawValue returns null and handle this situation in the script.
#718
General Support / Re: Best way to check if a file exists
November 16, 2022, 02:36:20 PM
You can make script DCI and process errors inside the script, e.g.:

s = $node->readAgentParameter("File.Size(/tmp/1/1.txt)");
if (s != NULL) return 1; else return 0;

s != NULL condition can be actually simplified:
s = $node->readAgentParameter("File.Size(/tmp/1/1.txt)");
if (s) return 1; else return 0;


I've used File.Size, as it is simpler and has just one parameter, but you can use File.Count as well.

P.S. Instead of script DCI you can use internal DCI with metric "Dummy" and have all the scripting in transformation script.
#719
General Support / Re: SNMP Trap Threshold
November 11, 2022, 01:18:28 PM
This could be done using filtering script in EPP. That script should keep last 10 timestamps somewhere (in persistent storage or in custom attribute of the node, as comma-separated list) and check if all these timestamps fit within 5 min interval.
Do you need an example of such script?
#720
Great, thanks for the update. Documentation is now updated.