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 - sperlm

#61
Sorry for not explaining - I am using $1 because I am running the script from Server Console and provide node name as first parameter of course. That is why I am "printing" the results.
I even tried to set node name (or ID) instead of $1 to remove the possibility this parameter is at fault.
If I set node name (e.g. Core1-SW) the error changes to:
_Error 5: Invalid operation with NULL value_

Thanks for the reply

Milan Sperl
#62
Hello, not sure if this is the right way but I would create dummy DCI and transform collected values from the CPU (like once per week do a weekly average).

This is interesting functionality, will try to follow this idea and let you know if this is the way to go.
#63
Hello,

   I have been creating filtering and even some scripts that imitate snmpwalk or trying to polish tool to mass-create DCI (based on my snmpwalk) but some problems with management functions arised.
(I am looking into python for nxshell functionality now, but I believe commands from Function Reference should be working without nxshell.)

Some functions work, but some do not and I don't know why..

For example - GetNodeParents, GetNodeInterfaces, GetObjectParents, GetObjectChildren

The first line where I use these functions makes the script broken, even test scripts like this are not working...
interfaces = GetNodeInterfaces($1);
foreach(i : interfaces)
{
    println "Interface: name='" . i->name . "' id=" . i->id;
}

All I get is: ERROR: Script finished with error: Error 14 in line 1: Function or operation argument is not an object

Can someone enlighten me what I do wrong please?

With regards

Milan Sperl
#64
Thanks for the reply, filters work exactly as I need now.

Few clarifications:

a)
In my previous question 4) I was referring to the wiki information under Templates section "Macros in template items"
QuoteYou can use various macros in name, description, and instance fields of template DCI.
namely: script:name - String returned by script name. Script should be stored in script library (accessible via Configuration -> Script Library). Inside the script, you can access current node's properties via $node variable.

To put the question short - where exactly it can be used?
(as the wiki information does not make sense to me - DCI form has no "name", macro {instance} can be used in the Parameter on the other hand)

b)
Performance tab - a little insight on this would be appreciated.
(did not find any on wiki or forums and this looks like it can solve my problem with viewing the collected data, namely the automated ones)

b)
If dci and node parameters are global, does it mean we can use class reference attributes like $node->snmpOID anywhere?
I am already filtering nodes for templates with this functionality so I assume it is possible.

c)
I also tried to use the same script functions from instance discovery in automatic apply rules for templates but could get results only with direct scripts, when I try to do the same thing with use/script it does nothing (or I was not able to test it properly).
#65
This is exactly what I needed, thank you.

I would like to ask some more questions to make it completely clear.

1) "$1" means "{instance}" then, are there other parameters or just this one?

2) Can I call scripts in the filter? Is it the "script:name" function?
(I am trying calling scripts now but cant get results yet)
Reason is obvious - to be able to change the filter for more DCIs at once than just one.
I am thinking about forwarding parameters to the script too.

3) Running configuration poll doesnt seem to work for me, I have to wait really long time to see the results. Is there a setting which disables this?

4) By the way, in the properties of OID there are no fields called name or instance so I am a bit confused as to where "script:name" functionality can be used.

Other questions which are not important for this topic but I would like to clarify to understand it better:

5) I already found "ApplyDCIFromTemplateToDisabledDCI" and set it back to old behaviour (1) so this means every change in DCI starts "reapplying" process and all I need is just wait or there is some static time (like 30 minutes) in which templates check if their nodes have actual OIDs?
I found ConfigurationPollingInterval (3600), not sure if it is correct information to look at though.

6) FindObject() function can be omitted in scripts if I dont need the safety function of returning null when the node is unknown/denied?

With regards

Milan Sperl
#66
Hello,

   I am trying to use the function of automate creating DCIs but I have a problem because I cannot properly use calling of scripts or dont know which parameters I can use within the filter (without scripts).

What I have:
Nodes with similar OIDs, but the tracked value (CPU usage) has different "last ID". In my case:
.1.3.6.1.4.1.25506.2.6.1.1.1.1.6.47
.1.3.6.1.4.1.25506.2.6.1.1.1.1.6.65 (etc)
All nodes have one common thing - all other values are "0"
So one node has trackable value in 47, all others are "0".

What I want to achieve:
Set DCI in template to apply DCIs based on having non-"0" value

What I achieved so far:
I set OID with these settings:

General
Description: CPU OID:{instance} (to make the DCI show number of the last ID)
Parameter: .1.3.6.1.4.1.25506.2.6.1.1.1.1.6.{instance} (to show scanned OID, I think when using Instance Discovery function this "parameter" could remain empty, it will still work so this is only for informative purpose too)
Origin: SNMP (just to be sure)
Data Type: Integer

Instance Discovery
Instance discovery method: SNMP Walk - OIDs
Base SNMP OID: .1.3.6.1.4.1.25506.2.6.1.1.1.1.6
Instance discovery fltering script: ...

... and this part is unknown for me.

It would be great if I could use some kind of parameter to get the value of the currently SNMPwalked OID so that I can simply write:

"walkedValue != 0;" (if the walked value is non-zero, proceed)

Or get the currently walked OID so that I can write a script:

transport = CreateSNMPTransport(FindObject($node));
varbind = SNMPGet(transport, walkedOID);
if (varbind->value != 0) return 1;
else return 0;

Or save the script to the script library and call it:

script:filter

To my underrstanding this is limited to name, description, and instance fields of template DCI so a "normal" call of script:

filter();

But there is still the problem with getting the walkedOID value so I am really at loss how to solve this. It seems there is definitely a way and I am just not being able to see it.

Can you please point me the way ?
Thanks in advance.

Milan Sperl
#67
Hi,

I am trying to to do exactly the same thing but how do I add a script to a template ?
Moreover, can I apply such template based on Infastructure so it affects only desired objects?

I am trying to get started with managing alot of switches and trying to come up with quick way to monitor only trunc ports and ignore all others in a handpicked heap of switches (wel it is logical net subgroup, but still want to keep the possibility of not including an object based on it being placed in the Infrastructure or not).

I am sure selecting/excluding port 49-50 to set its expected status UP is not a big deal afterwards. I just need to get started somehow with the script two posts above.