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

#6571
Windows / Re: compile nxlexer files
January 25, 2010, 03:03:35 PM
Hi!

What version of Scintilla library you are using? Class PropSet defined in PropSet.h from Scintilla library. I use version 1.67, which probably outdated - may be this is the problem.

Best regards,
Victor
#6572
A kakoj u faila pravil'nij timestamp? Ne zabivajte, chto eti parametri vozvraschajut UNIX timestamp, t.e. kolichestvo sekund s 1 Jan 1970 00:00:00 UTC. Esli nado perevesti v drugoj format, to eto mozno sdelat' cherez transformation script dlja DCI.
#6573
Polls / Re: Smartphone client
January 19, 2010, 01:19:31 PM
Currently we don't have blackberry device for testing, and I have no idea how hard development for blackberry could be. It's not very popular in my country, so I just forgot to include it in the list. However, I'll add blackberry to the list to see how big is demand for blackberry client.

Best regards,
Victor
#6574
Windows / Re: compile libnxsl files
January 19, 2010, 12:08:33 PM
Hi!

You need flex version 2.5.33 or above.Looks like GnuWin32 still uses 2.5.4. I personally use flex and bison (and other tools like grep, etc.) from MSYS (http://www.mingw.org/).

Best regards,
Victor
#6575
Windows / Re: compile libnxsl files
January 18, 2010, 01:52:02 PM
Hello!

Looks like double quotes are missing somewhere, and because bison is installed into C:\Program Files\... it breaks on a space in a path. Try to install GnuWin32 tools into directory without spaces in the path.

Best regards,
Victor
#6576
Quote from: wonderboy on January 15, 2010, 03:04:02 PM
Спасибо за помощь, но сразу возник еще один вопрос.

Так как на разном оборудовании разные порты могут быть серверными, транковыми и т.д.
Решил в дескрипшенах писать что-то типа Trunk ... , User ... , Server ...
И иметь всего 3 правила на все устройства.

Пишу в политике для эвента SYS_IF_DOWN скрипт ($2 - содержит имя интерфейса в указанном выше формате):
sub main() {
if ($2 ~= "Trunk")
{
  return 1;
}
}


Но вот видимо не срабатывает, потому что алярмы свой приоритет не меняют.

PS: Stdout куда выводятся print, println это где? Куда нужно смотреть? :)

Скрипт выглядит правильно. Stdout доступен только если скрипт запущен через nxscript. Приведенный выше скрипт можно протестировать например так:

1. создать файл test.nxsl, скопировать в него скрипт;
2. запустить команду

nxscript -r test.nxsl param1 param2


Результат будет примерно такой:


C:\Source\NetXMS\debug>nxscript -r test6.nxsl param1 param2
NetXMS Scripting Host  Version 1.1.0-rc10
Copyright (c) 2005-2009 Victor Kirhenshtein

Result = (null)

C:\Source\NetXMS\debug>

C:\Source\NetXMS\debug>nxscript -r test6.nxsl param1 Trunk
NetXMS Scripting Host  Version 1.1.0-rc10
Copyright (c) 2005-2009 Victor Kirhenshtein

Result = 1

C:\Source\NetXMS\debug>


Если в скрипте для отладки нужна печать на экран, то можно использовать print / println:


sub main()
{
   println "$2='" . $2 . "'";
   if ($2 ~= "Trunk")
   {
      println "match";
      return 1;
   }
   println "no match";
}


Получим


C:\Source\NetXMS\debug>nxscript -r test6.nxsl param1 param2
NetXMS Scripting Host  Version 1.1.0-rc10
Copyright (c) 2005-2009 Victor Kirhenshtein

$2='param2'
no match
Result = (null)

C:\Source\NetXMS\debug>

C:\Source\NetXMS\debug>nxscript -r test6.nxsl param1 Trunk
NetXMS Scripting Host  Version 1.1.0-rc10
Copyright (c) 2005-2009 Victor Kirhenshtein

$2='Trunk'
match
Result = 1

C:\Source\NetXMS\debug>

#6577
В заголовке окна видна пометка "modified". Event processing policy вступает в силу только после того, как она сохранена на сервере. Эти тестовые изменения были сохранены?
#6578
General Support / Re: XML file
January 14, 2010, 08:31:18 PM
Hello!

Not directly from console. However, you can upload any file to agent via nxupload command line tool (should be run from server). All uploaded files will be placed in agent's upload directory, defined by FileStore parameter in agent's configuration file.
You can also create fake upgrade package which will just deliver required file and distribute it via agent upgrade mechanism from console.

Best regards,
Victor
#6579
Привет!

В нынешней версии это сделать не получится. Я добавил NXSL функцию GetInterfaceName, в следующей версии она будет доступна. Тогда можно будет подставлять имя интерфейса через скрипт, например так:

1. Сделать скрипт в Script Library под названием resolve_if_name


sub main()
{
   return GetInterfaceName($node, $event->parameters[2]);
}


2. В текст сообщения добавить вызов скрипта:


Link is down (interface name %[resolve_if_name])


Best regards,
Victor
#6580
General Support / Re: SQL query failed
January 12, 2010, 02:45:01 PM
Hi!

Looks like your database is somewhat broken. Could you please run netxmsd with -D 9 option (highest debug level) for a short time and post netxmsd log to [email protected]?

Best regards,
Victor
#6581
General Support / Re: Questions about Netxms Console
January 08, 2010, 04:21:14 PM
Hello!

You cannot send SNMP traps from agent. Agent can only communicate with NetXMS server using it's own protocol. You can however send traps from NetXMS server simply by defining command type action and calling any trap sending utility, for example snmptrap from net-snmp package.

You can retrieve node's custom attributes in scripts in event processing policy in two ways:

1. If name of your attribute conforms to NXSL identifier naming conventions (contains only letters, digits, _ and $ and do not start with digit), you can access any attribute as attribute of node object. For example, to access custom attribute named attr1, you can use


$node->attr1


2. You can use NXSL function GetCustomAttribute. For example, to custom attribute named attr2, you can use


GetCustomattribute($node, "attr2")


Also, if you just need to add custom attribute's value to event or alarm message, you can use macro %{attribute_name}, for example, you can define alarm message as


Some alarm - custom attribute attr1 goes here: %{attr1}



Best regards,
Victor
#6582
General / Re: problem with development
January 08, 2010, 04:12:55 PM
Hello!

Did you set VID_PARAMETER variable before sending CMD_GET_PARAMETER request? You should have something like

msg.SetVariable(VID_PARAMETER, "Agent.Version");

before converting message into binary format and sending. Also, check VID_RCC variable in response message - may be it contains error.

Best regards,
Victor
#6583
Hello!

In fact, there are two timeouts - one on agent side, for script execution, and one on server side - for agent response to command. If you have external parameters with long execution time, you should also increase value for server's parameter AgentCommandTimeout, which is 2 seconds by default.

Best regards,
Victor
#6584
Try to replace netinfo.cpp with attached one.

Best regards,
Victor
#6585
General Support / Re: Not able to connect Database
January 07, 2010, 01:13:08 PM
Your database user netxms does not have access rights to database netxms. Try to grant required rights with the following MySQL query:


GRANT ALL ON netxms.* to netxms@localhost;


Best regards,
Victor