NetXMS Support Forum

Please login or register.

Login with username, password and session length

Author Topic: Interface.setStatusPropagationMethod() ?  (Read 265 times)

Staj

  • Newbie
  • *
  • Posts: 28
    • View Profile
Interface.setStatusPropagationMethod() ?
« on: October 03, 2018, 12:23:13 pm »

In NXShell, would you please consider implementing a AbstractObject.setStatusPropagationMethod or Interface.setStatusPropagationMethod method, or some other implementation that allows us to set status propagation, to allow for things like setting the status propagation of interfaces? Setting this up manually for many interfaces over many nodes is very tedious.

Someone else was, more or less, asking about this back in 2013 as well.
« Last Edit: October 04, 2018, 08:39:34 am by Staj »
Logged

Staj

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Interface.setStatusPropagationMethod() ?
« Reply #1 on: October 03, 2018, 01:04:59 pm »

For those looking to do this in SQL, here is some information:

Relevant data is kept in the object_properties table.
object_properties.status_prop_alg is the Propagate Status Method and acceptable values are defined in nxcldefs.h:307.

Default:
object_properties.status_prop_alg = 0

Unchanged:
object_properties.status_prop_alg = 1

Fixed to value:
object_properties.status_prop_alg = 2
object_properties.status_fixed_val is the Status it will be fixed to, acceptable values are 0 through 4 (netobj.cpp:1682) as defined in nxcldefs.h:138.

Relative with offset:
object_properties.status_prop_alg = 3
object_properties.status_shift is the offset applied to the actual status value.

Severity Based:
object_properties.status_prop_alg = 4
object_properties.status_translation is the mapping of actual status values to propogated ones. It is split into 4 segments of 2 characters which essentially represent the status integer for the respective slot.
First segment is the propagated status for a Warning status.
Second segment is the propagated status for a Minor status.
Third segment is the propagated status for a Major status.
Fourth segment is the propagated status for a Critical status.

So object_properties.status_translation of "00010303" would yield Normal (00 which is 0) being propagated for Warning, Warning (01 which is 1) being propagated for Minor, Major (03 which is 3) being propagated for Major and Major being propagated for Critical.

Example SQL Snippet (MySQL):
Set all matching interfaces (Interfaces with names that starts with "ge-") of node of ID 1234 to propagate status on a severity based (severity translated) basis and use the provided translation mapping:
Code: [Select]
UPDATE object_properties
INNER JOIN interfaces ON interfaces.id = object_properties.object_id
SET object_properties.status_prop_alg = 4, object_properties.status_translation = "01020303"
WHERE interfaces.node_id = 1234 AND object_properties.name LIKE "ge-%"

If I've made any mistakes, please let me know.
« Last Edit: October 03, 2018, 01:25:37 pm by Staj »
Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6365
    • View Profile
Re: Interface.setStatusPropagationMethod() ?
« Reply #2 on: October 03, 2018, 04:57:33 pm »

In nxshell you can so whatever is possible from UI. Object modifications should be done via NXCSession.modifyObject method - you set necessary fields in object modification data object and then call modifyObject.

Best regards,
Victor
Logged

Staj

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Interface.setStatusPropagationMethod() ?
« Reply #3 on: October 04, 2018, 08:39:09 am »

I should have looked more closely, even at my old nxshell scripts. Thanks.
« Last Edit: October 04, 2018, 08:46:16 am by Staj »
Logged