Setting custom alarm for each condition object

Started by Danxy, December 14, 2022, 01:21:32 PM

Previous topic - Next topic

Danxy

Hi there. I have a lot of Condition objects and I try to assign to each one different alarm. The easiest way would be to create one event for each Condition object and then create event processing policy for each event i.e Condition. But this would be a painful work, create so much EPPs. I am wondering if I can create one EPP for all events and somehow insert message that refers to Condition object or event? 
I tried something with adding persistent storage variable and setting it in Condition object script (I don't know if this works), creating EPP macro that returns persistent storage variable and call it in Alarm Message field but this won't work :'(
Is there any way to do this? 

Filipp Sudanov

Hi!

Actually, Condition objects are planned for removal in a future version, as there are now other options to do things.
Can you illustrate your use case, what exactly these conditions do and where they take the data?

Danxy

Quote from: Filipp Sudanov on December 14, 2022, 06:46:10 PMHi!

Actually, Condition objects are planned for removal in a future version, as there are now other options to do things.
Can you illustrate your use case, what exactly these conditions do and where they take the data?

Thank you, good to hear, now I am not sure if I can use Netxms for my case. It is following:
I need to monitor a number of devices exclusively with SNMP. All I need is to poll OIDs (integers) and depending on calculation using several OIDs on the same device create normal, warning and critical alarm and show on dashboard network map (I need to freely arrange icons) green, yellow and red boxes of each device and "subdevice" (I found floor plan layout is best for my purpose). I think that condition object is the only possible solution for this. 

Filipp Sudanov

Let me list what are the options:

- On the nodes you can have script DCI that polls needed OIDs (or takes their values from another DCIs) and takes some numeric value. Then
  - on map you can use "DCI image" element, which will show specific image for specific value
  - or on that scipt DCI you can check "Use this DCI for node status calculation" (it's in properties on Other Options tab) - and value of that DCI will affect the status of the node (value should be between 0 and 4 for normal ... critical)
You can have this DCI in a template, it will be applied automatically.



- You can use business service functionality - it was reworked in 4.0. The idea is that business service object checks status of other things (nodes, DCIs or script) and changes it's status (and also calculates time that it was "up" or "down").
Creation of business services can be automated - there are "business service prototypes" and auto-bind scripts that will pick up DCIs or nodes that you need.



- Third option is to create nodes with IP address 0.0.0.0 - such node will not be polled. You can have a DCI on that node with "Use this DCI for node status calculation" enabled and status of that node will depend on value of that DCI.


Pls update which option looks good for you and if you need any additional information on it.


Danxy

Thank you for the suggestions, but I am not not sure about your options. The problem is that I need to poll from one node let's s say 10 OIDs and get 10 DCI values, and then I need to get value based on calculation of 3 DCI values and then show result of calculation as an image on the map in certain color. Then take another 3 DCI values, make calculation and show on map and so on.  
Your first option shows on map image using only one DCI value, and I am not sure that other two options can do what I want. 
I need some time to figure out business services, but it seems that is is also based on one calculation for each DCI, not group of them. 

Filipp Sudanov

I'd suggest investigating business service approach. If it does not fit for some reason we can look at the other options again.

A business service has concept of "checks". These are visible in "Object details" as a tab. There can be one or several checks - these could be DCIs (status of the check depends whether a threshold on the DCI is triggered or not) - and there are object status checks and script checks.
Also, business services can be nested - a business service can contain a number of child business services. Status of child business services will be propagated to the parent business service, so it could also be built that way.

Danxy

I tried with business services, managed to get something but mostly it is not useful for my purpose. Here I don't see possibility to make script and get result based on DCI values calculation in checks. Condition object was perfect, to bad you are going to remove it.
 

Filipp Sudanov

Returning a bit back - there was another approach - to have script DCIs which are pulling several OIDs and doing calculation right within the script. Code of such script DCI might look like this:

transport = $node->createSNMPTransport();
if (transport == null) return null;

value1 = transport->getValue(".1.2.3.4.5.6.7.8");
if (value1 == null) return null;
   
value2 = transport->getValue(".1.2.3.4.5.6.7.8");
if (value2 == null) return null;
   
return value1/value2;   

Then on the map you can add "DCI Image" objects. In properties of these "DCI Images" you can configure what image to display depending on the value of the DCI. 

If you go with this approach, is there anything that is missing?

Danxy

Thanks, It looks  promising, but I couldn't find in documentation how to connect scripts with polls. 
When I want to add DCI image, I have to specify DCI in Data source, I cannot select anything else. Which object (connected with my script) I have to create to be able to connect it to DCI image? Or to rephrase, I understood scripts are in Script Library, where I have to call this script to be able to connect with DCI image?

Filipp Sudanov

There are two parts:

1) On a node you have a DCI with Origin="Script". The script itself is in script library, DCI has name of that script in "Parameter" (renamed to "Metric" in most recent version) field. It's also possible to pass some parameters to the script by putting:
script_name("parameter_1", "parameter_2")
or
script_name(123,456)

Script does it's job, reads some values from nodes, etc. Finally script returns some value with the help or return operator. The value returned by the script is stored as the value of the DCI - it's visible in last values, can be seen on graph, etc.

2) On the map, "DCI image" object has this DCI as data source. In properties of the DCI image you can configure the default image and what images should be used if DCI value goes to  some specific value.

Danxy

#10
Great, thank you. That works. But now I have other problems. I have had grouped equipment into containers in such way that I put let's say two conditions into container, another two conditions into second container and then put both into a new container to have status propagation and possibility to unmanage the groups. To do similar thing, I created business services and try similar using script DCI threshold check.
The problem is that on false result in script I've got two alarms, one on basic and another on parent business service, and I need only one. Can I somehow disable screen notification (and sound) of parent business service retaining red mark on icon?
The second problem is that alarm is deleted in alarm browser view unlike infrastructure services object alarms, which are kept in alarm browser.
There is also third problem, unmanaging the business service does not stops the alarms?!