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

#586
В правах доступа нас интересуют галочки, которые справа. Они все выставленны, так что на эту ноду у группы Admins есть все права и у пользователя, состоящего в этой группе должна быть возможность делать все действия.

Так что не очень понятно, в чем тут может быть дело. Если есть подозрение, что не работает на определенных машинах, можно собрать лог агента на 6 уровне отладки. Для этого в конфиг файл агента поставить:

LogFile =  C:\NetXMS\log\nxagentd
DebugLevel = 6
#587
Все правильно описали
- session agent нужен для скриншотов, запускается в каждой сессии
- user support application тоже умеет делать скриншоты, так же запускается в каждой сессии. Но еще умеет покзаывать юзеру нотификации и в ней можно наконфигурить пользовательское меню, запускающее какие-либо команды. Конфигурация эта делается в Template -> Agent Policies - там есть тип политики user support application.

И тот и другой прописываются в автозапуск в Windows, но для user support application есть еще параметр в конфиге агента AutoStartUserAgent чтоб перезапускать эту аппликацию, если юзер из нее выйдет.
#588
Можно теоретически из трансформационного скрипта этого табличного DCI раскидывать значения по другим DCI. Но удобнее так:

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

#589
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.
#590
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...)
#591
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?


#592
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.
#593
А можно тот же скриншот, что на Access Control.png, но выделить мышью группу Admins
#594
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))
#595
Access denied может быть и со стороны NetXMS сервера - если нет права "control" на этот объект. В принципе покажите, какие права есть на этот объект, может быть на работу с файлами тоже прав не хватает.

#596
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.
#597
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.
#598
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.
#599
У меня не получилось повторить. В каких случаях это происходит, на ноде есть агент, или есть SNMP, что-то из этого перестает отвечать?
#600
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