NetXMS Support Forum

English Support => General Support => Topic started by: Nagav on July 13, 2015, 04:11:55 PM

Title: sample NXSL script that calculates the object status
Post by: Nagav on July 13, 2015, 04:11:55 PM
Hi
Can any one provide me sample NXSL script that calculates the object status as neede
I need to change status of condition object based not only based on Active/Inactive status

That is based on some value, I need to change status of conditional object status to Normal, Warning, Minor, Major, Critical

Example
if the value is > 100 change stataus to normal
         value is < = 100 and > 91 change status to Warning
         value is 90 <= and >81 change status to Minor
         --- etc
Please provide sample script that I can refer to
From net can see there is something like setStatusCalculation, but I could not get examples on using it
Is it possible to use setStatusCalculation in condition object's status script ?
Title: Re: sample NXSL script that calculates the object status
Post by: Victor Kirhenshtein on July 14, 2015, 09:12:28 PM
Hi,

condition object is limited to have only two possible statuses. However, you can create node object without IP address, then create script DCI on it that will return status as a number from 0 (normal) to 4 (critical) and mark this DCI as "status DCI". You'll have node with status based only on value provided by your script.

Best regards,
Victor
Title: Re: sample NXSL script that calculates the object status
Post by: Nagav on July 16, 2015, 12:51:40 PM
Thanks Victor for response, now I could create object with required status
Title: Re: sample NXSL script that calculates the object status
Post by: Nagav on July 16, 2015, 01:40:13 PM
I did created note object/status DCI as suggested by you, however the status symbol is not changes based on status value
I have attached screenshot of it for your reference, kindly advise me if I have make anyother changes to get appropriate status symbol
Also I do not want tooltip to display default info (255.255.255.255...etc), is it possible to give my own comments based on status value.
Title: Re: sample NXSL script that calculates the object status
Post by: Victor Kirhenshtein on July 16, 2015, 06:03:37 PM
I mean a bit different thing. Try to do the following:

1. Create script in script library that will calculate status as you need it.
2. Create script source DCI, select your script as source, check "use for status calculation" option.
3. Don't forget to remove "use for status calculation" option from internal status DCI.

Best regards,
Victor

P.S. also, you should use address 0.0.0.0 to create node without IP address.
Title: Re: sample NXSL script that calculates the object status
Post by: Nagav on July 17, 2015, 10:27:01 AM
Excellent, it is working
Now I want some details to be displayed in tooltip based on status value, may I know how to do it ?
Is there any NXSL function available which I use to set Node object's tooltip based on status value
I tried to use Comments, but it is same for all status

I have requirement to discribe the steps that the operator need to perform based on status of node

Please help 
Title: Re: sample NXSL script that calculates the object status
Post by: Victor Kirhenshtein on July 27, 2015, 10:34:59 AM
Hi,

do you mean tooltips on network map?

Best regards,
Victor
Title: Re: sample NXSL script that calculates the object status
Post by: Nagav on July 27, 2015, 02:42:28 PM
Hi

I need to change tooltip of object ( in my case node) that has been added to map
I need to change tooltip based on status value of object.

Regards
Naga