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

#721
Можно теоретически из трансформационного скрипта этого табличного DCI раскидывать значения по другим DCI. Но удобнее так:

- Сделать ExternalList, который будет запускать скрипт, возвраюащий список datastore.
- Этот list можно использовать для instance discovery, чтоб DCI создавались автоматически
- Сделать ЕxternalMetricProvider, который будет запускать скрипт, возвращающий метрики для всех datastore - он может возвращать данные в формате
MetricName(datastore_name)=Value

#722
dciId = 2531;
threshold = 500 * 1000 * 1000;

t = localtime();
t->hour = 0;
t->min = 0;
t->sec = 0;
endTime = mktime(t);

if (t->mon >= 2) {
  t->mon = t->mon - 1;
}
else
{
  t->mon = 12;
  t->year = t->year - 1;
}
startTime = mktime(t);

a = GetDCIValues($node, dciId, startTime, endTime);

HighCnt = 0;
Cnt = 0;

for (v : a) {
  Cnt++;
  if (v > threshold) HighCnt++;
}

return HighCnt / Cnt;

Here's an example script that grabs all values for a DCI for last month. You can put this in a script DCI that is being collected by cron schedule on the first day of each month.

Once you nave array with values, you can do various calculations with them. If you want to do calculations that involve big numbers, e.g. calculating average value, initialize variable like that:

TotalCounter = 0L;

This will use INT64 for this variable.
#723
Actually, can you attach an example of how export from the Dude looks like? We might be interested in adding some out-of-the box scripts for import as this might be useful for many people.

Is it only the list of nodes, or there is some other useful data from the Dude that can be exported (e.g. templates with OIDs for SNMP polling, etc...)
#724
I've played a bit trying to replicate this, but did not get any success.

There are two different things - creation of alarm and increasing count for already existing alarm.


When a new alarm is created, HOOK:AlarmStateChange is not being executed (as it runs only when status changes for already existing alarm).

But when alarm already exists and status changes (e.g. Alarm was previously acknowledged and changes to outstanding), this script will be executed.
If alarm is terminated by EPP, script will also be executed and $alarm->state will be equal to 3.


Can you give some exact sequence of what was happening on your system - was alarm already present on a node or it was created? Based on what event alarm is created? Are there any EPP rules that could modify or terminate the alarm?


#725
Yes, URL field supports macros, so %[OGAckAlarmID] should work. I am not sure how you are getting alarm ID in that script, may be you should pass the ID as parameter in your PostEvent() calls.

Request Data field is employed when web service is used as data source for a DCI. When using post() method of web service object, that field is ignored, so you have to pass the whole request in post() call.
#726
А можно тот же скриншот, что на Access Control.png, но выделить мышью группу Admins
#727
Here's nxshell script that does the same job. nxshell is Jython implementation of Java API. You need to install nxshell to use this, on Linux this is included in netxms-client package

To execute the script:
nxshell -u admin -P password create_nodes.py

import csv

print("=========================================================================================================")

with open('nodes.csv') as csv_file:
    reader = csv.reader(csv_file, delimiter=',')
    data = [row for row in reader]

Infrastructure = session.findObjectByName("Infrastructure services")
if Infrastructure is None:
    print("Infrastructure services not found")
    quit()

flags = NXCObjectCreationData.CF_DISABLE_ETHERNET_IP

for i in range(0, len(data)):
    node_name = data[i][0].strip()
    node_address = data[i][1].strip()
    node_container = data[i][2].strip()
    Container = session.findObjectByName(node_container)
    if Container is None:
        cd = NXCObjectCreationData(objects.GenericObject.OBJECT_CONTAINER, node_container, Infrastructure.objectId);
        node_container_id = session.createObject(cd)
        print('Container "{}" created, id={}'.format(node_container, node_container_id))
    else:
        print('Container "{}" already exists'.format(node_container))
        node_container_id = Container.objectId
    Node = session.findObjectByName(node_name)
    if Node is None:
        cd = NXCObjectCreationData(objects.GenericObject.OBJECT_NODE, node_name, node_container_id);
        cd.setCreationFlags(flags);
        cd.setPrimaryName(node_address)
        nodeId = session.createObject(cd)
        print('Node "%s" created, id=%d' % (node_name, nodeId))
    else:
        print('Node "%s" already exists' % (node_name))
#728
Access denied может быть и со стороны NetXMS сервера - если нет права "control" на этот объект. В принципе покажите, какие права есть на этот объект, может быть на работу с файлами тоже прав не хватает.

#729
First of all, there is built-in support for web services in NetXMS. It's possible to set up DCIs that get data from web services, but there's also ability to use them from NXSL scripts https://www.netxms.org/documentation/nxsl-latest/#class-webservice

It's probably not a good idea to have long operations in hook scrips, so I would call PostEvent() from NXSL and then have a rule in EPP that catches that event and calls server action which calls NXSL script.
#730
General Support / Re: Netflow supported?
April 25, 2023, 02:08:50 PM
Currently it's not supported. There are plans to implement it, but it's not clear how soon this could be. If, just in case, your company wants to sponsor this development, feel free to contact us.
#731
General Support / Re: netXMS server occupied space
April 25, 2023, 01:39:51 PM
First of all, you can check what exactly tables take the most space in your database, e.g. for MySQL: https://stackoverflow.com/questions/9620198/how-to-get-the-sizes-of-the-tables-of-a-mysql-database

Log retention time is set in Configuration -> Server configuration, search for "RetentionTime" there.
Next housekeeper run after you have changed retention times will delete records according to the new retention time.

But databases typically do not instantly return all freed space to the file system. Depending on the database, you might need to execute some command for data compacting, e.g. VACCUUM for postgres database.
#732
У меня не получилось повторить. В каких случаях это происходит, на ноде есть агент, или есть SNMP, что-то из этого перестает отвечать?
#733
The issue is with how the subject is parsed when we try to match the user which corresponds to the certificate. Code was written with openssl certs in mind, but for Microsoft certs subject is composed differently (has DC= serveral times, etc).
The certificate itself is validated ok, that's why there's no "validation failed" in the log, but server can not match certificate with a user, thus Access Denied.

Will fix
#734
General Support / Re: Attach device id to node
April 11, 2023, 04:19:31 PM
There's new asset management functionality coming in 4.4. There will be option to configure the fields and fill them in for each node. I think there should also be a search mechanism.
There's no mechanism to display these fields exactly on overview tab, but this could be achieved by a script DCI displayed there or by script macro called from commend field.

Also, when this will be implemented, these values could be put into built-in fields from configuration poll hook: https://track.radensolutions.com/issue/NX-2402

In current version you can either use a custom attribute or a push DCI (e.g. you can use script object tool to edit the value).
Searching could be done using "Find object" query, pls update if you need an example on this.
#735
General Support / Re: Find Switch Port - Bug
April 11, 2023, 01:46:33 PM
Should be fixed now, pls check most recent patch release