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

#5656
General Support / Re: Alarms
December 27, 2011, 11:17:42 AM
Hi!

There are some confusion caused primarily by giving script itself and a function inside this script the same name. In "use" operator you should use script name (you can think of it as of virtual file name) - the one you see in script list in the library. Then, you can call functions from that script using their respective names - name of the function may or may not be identical to script name. Note that each script has it's own main() function, even if you do not declare it explicitly, so you cannot call main() function of another script. One script may provide multiple functions, like in this example:

Script in the library called "MyScript":


/* function 1 */
sub f1(p)
{
   println "f1 called with parameter " . p;
}


/* function 2 */
sub f2(p)
{
   println "f2 called with parameter " . p;
}


and then you use it in some other script:


use MyScript;  /* load script from library by it's name */

f1(1);  /* call function f1 */

f2(2); /* call function f2 */


Script above will produce output


f1 called with parameter 1
f2 called with parameter 2


Best regards,
Victor
#5657
Hi!

Quote from: dogz on December 27, 2011, 06:26:03 AM
I would like to know the problem is due to the web service stop or the web service is started but can't response (maybe Apache daemon is dead) or due to the programming failure or the web page is changed by crackers and so on.

You should monitor multiple things and react to them differently. First, you should monitor state of Apache service via System.ServiceState parameter.  If it is not running, you can automatically restart it using actions. Also, you probably should monitor that your web server responds correctly to HTTP requests. You can done it by creating network service under web server node, or by using ServiceCheck.HTTP agent's parameter. Search the forum, there should be instructions about network service configuration. Also, if you have static web pages, you might want to monitor that they are not changed by using ESC subagent - it provides checksum calculation for web pages.

Best regards,
Victor
#5658
General Support / Re: Alarms
December 25, 2011, 05:33:35 PM
You should not have function main() in library script. Try to change it like this:


sub CISCO_Config_Event_Config(e)
{
    switch(e)
    {
    case 3: return "running";
    case 4: return "startup";
    }
}


It is strange that server crashes. I'll try to reproduce it myself.

Best regards,
Victor
#5659
General Support / Re: Alarms
December 25, 2011, 01:42:24 PM
Parameters can be passed to subroutines like that:


sub main()
{
   f(1, 2);
   f(3, 4);
}

sub f(p1, p2)
{
   println "parameter 1 is " . p1;
   println "parameter 2 is " . p2;
}


If you have multiple parameters which needs to be converted using same function, you can create separate script in the library containing this function, and call it from different small scripts. For example, create script called "convert" with function "convert":


convert(p)
{
   // do conversion here
   return converted_value;
}


then create scripts like that for each parameter:

convert_p1:


use convert;
return convert($event->parameters[1]);


convert_p2:


use convert;
return convert($event->parameters[2]);


and so on.

Best regards,
Victor
#5660
General Support / Re: Alarms
December 25, 2011, 01:25:17 PM
Hi!

Currently it is not possible - server always calls main() subroutine when expanding %[] macro. I can add an option to specify parameters and/or entry points to these scripts - in 1.1.8 or 1.1.9, depending on how fast I will fix other things from to-do list.

Best regards,
Victor
#5661
General Support / Re: cannot install netxms webserver
December 25, 2011, 01:19:51 PM
Sorry, I forgot to mention it - in 1.1.x correct configure option is --with-webui instead of --with-nxhttpd.

Best regards,
Victor
#5662
General Support / Re: Alarms
December 22, 2011, 07:24:33 PM
If I understand you need correctly, you need script which will convert numeric codes into strings, right? Then you can do the following:

Create script in script library, with some name, let's say "convert" (here I assume that you need to convert event's parameter %2 into text - otherwise change index in parameters[] accordingly):


switch($event->parameters[2])
{
   case 1: return "test";
   case 2: return "test2";
   // and so on...
}
return "unknown"; // default value


and then use it in a message like %[convert]

Best regards,
Victor
#5663
General Support / Re: Export: cannot load schema file
December 22, 2011, 11:50:41 AM
Hi!

It's a bug. Unfortunately there are no workaround, you have to wait for version 1.1.8 with a fix.

Best regards,
Victor
#5664
General / Re: About the discover poll
December 22, 2011, 11:47:56 AM
Yes, that's correct.

Best regards,
Victor
#5665
It's fixed already in the trunk, so 1.1.8 will not have this bug.

Best regards,
Victor
#5666
Try to use netstat -atnp command - then you will see what exact process keeps this port open.

Best regards,
Victor
#5667
General Support / Re: cannot install netxms webserver
December 21, 2011, 12:13:09 PM
It should be under /usr/local/bin if you have used default prefix.

Best regards,
Victor
#5668
What operating system is on remote machine?

Best regards,
Victor
#5669
Feature Requests / Re: Properties on containers?
December 21, 2011, 10:34:40 AM
I agree that this may be useful. One problem is conflict resolution - node can be placed in multiple containers - what settings should be taken in tah situation?

Best regards,
Victor
#5670
Feature Requests / Re: Select polling IP address per DCI
December 21, 2011, 10:33:09 AM
Yes, I want to create new object type "management board" for this type of situations. I'm also have a lot of servers with iLO boards :)
Currently you can use the following method as a workaround:

1. Create separate node object for management board
2. Add server node object to "trusted nodes" list of management board node object
3. Create DCI on server node object and specify management board node object as "proxy node"

Then you will have DCIs on server node object, but they will be collected from management board.

Best regards,
Victor