News:

We really need your input in this questionnaire

Main Menu
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 - MarcusH

#46
General Support / Re: JSON NXSL
August 26, 2022, 04:42:52 PM
Almost always when you post a question you find an answer shortly after. I Solved my counting issue by using ->replace("[", "")->replace("]", "")->split(",")
With that i get an array with a JSON in each that i can loop through.
#47
General Support / JSON NXSL
August 26, 2022, 04:16:54 PM
Hi,

Working on integration NetXMS with GLPI using RestAPI and web service definitions. Everything is working except i can not get a handle arround the JSON response.

Is there no support for JSON arrays in NXSL functions?

For example i have this response and i want to loop these values and count total


[
   {
      "id": 178
   },
   {
      "id": 179
   },
   {
      "id": 181
   }
]
#48
General Support / Re: Script DCI
May 12, 2022, 09:12:32 AM
$dci works

Here exemple on what i have done.

CheckDownStatus(container objectid) loops all nodes in the container and gets latest value from DCI named Down, if any node has been down over 80 seconds it returns 80 else 0.

All below is run on same node named PushNode, this node is trusted on all nodes since i have trusted nodes active.

This version is run by a script DCI and pushes down value to a DCI with origin Push on PushNode

sub CheckDownStatus(obj)
{
  foreach(o : obj->children) {
  if(!o->isInMaintenanceMode)
  {
    downsince = GetDCIRawValue(o, FindDCIByName(o, "Down"));
    if(downsince > 80)
    {
    return 80;
    }
    }
  }
  return 0;
}

// AP Zone 1
PushDCIData($node, 3115, CheckDownStatus(FindObject("9347", $node)));
// AP Zone 2
PushDCIData($node, 3117, CheckDownStatus(FindObject("12216", $node)));


This version returns value to the same DCI that runs it, and as stated above only works from version 4.1.283

sub CheckDownStatus(obj)
{
  foreach(o : obj->children) {
  if(!o->isInMaintenanceMode)
  {
    downsince = GetDCIRawValue(o, FindDCIByName(o, "Down"));
    if(downsince > 80)
    {
    return 80;
    }
    }
  }
  return 0;
}

test = $dci->id;

// AP Zone 1
if(test = "3115"){ return CheckDownStatus(FindObject("9347", $node));}
// AP Zone 2
if(test = "3117"){ return CheckDownStatus(FindObject("12216", $node));}


My reason for these is that now i have one DCI that i can monitor if any node goes down in that group. I also like having things in scripts gives me more freedom, in some cases we call action on agents like the agent that is on the PC that runs the grafana screens has an action for text2speech and that is speaking some alarms with values that needs immediate action.

#49
General Support / Re: Script DCI
May 11, 2022, 11:52:57 AM
Changed approach, one DCI that runs script and script then push return to different push DCI
#50
General Support / Script DCI
May 11, 2022, 10:42:34 AM
Hi,

Is there any way to in a script that runs as DCI identify which DCI that started the script?
I am trying to make one script for multiple DCI
#51
General Support / Re: Trusted Nodes
May 11, 2022, 10:38:49 AM
Indeed i was deep in loops of trial and error to get it to work and i just tested it and it worked and just as i saw your reply i got how simple it was and how unnecessary advanced i made it :)
#52
General Support / Re: Trusted Nodes
May 11, 2022, 10:25:12 AM
Ah i got it working with trustednodes = [session.findObjectById(objectID).getObjectId()] but data.setTrustedNodes([trustedNodeId]) is cleaner
#53
General Support / Re: Trusted Nodes
May 11, 2022, 09:44:23 AM
Here is the entire code i am trying to get working, i get TypeError: setTrustedNodes(): 1st arg can't be coerced to java.lang.Long[]

# Add trusted nodes to list
trustednodes = [session.findObjectById(objectID)]

# Container to add trusted nodes to
container = session.findObjectById(objectID)

# Loop nodes in container
for node in container.getAllChildren(objects.GenericObject.OBJECT_NODE):
print node.getObjectName()
data = NXCObjectModificationData(node.getObjectId())
data.setTrustedNodes(trustednodes)
session.modifyObject(data)
#54
General Support / Re: Trusted Nodes
May 11, 2022, 08:39:11 AM
Got a script working that loops all nodes in a container but i cannot get setTrustedNodes to work, i think i have it down to NXCObjectModificationData not working in my case, happy for any pointers :)

Tried this simple code for verification and it does not work only get NoneType from data.

print node.getObjectId()
data = NXCObjectModificationData(node.getObjectId())
print data.getName()
#55
General Support / Re: Maleformed eMail
May 11, 2022, 08:16:23 AM
Hi,

We have the same issue on 4.1.283 and FromName= is correct.
#56
General Support / Re: Trusted Nodes
May 10, 2022, 02:48:18 PM
Perfect thanks alot, i have had trusted nodes active for a long time just first time i need to add a trusted node on a lot of nodes.
#57
General Support / Trusted Nodes
May 10, 2022, 08:26:40 AM
Hi,

Are there any ways to manage trusted nodes in bulk or do you need to righ click every single node and add trusted node?
#58
General Support / Re: NetXms slow responsiveness
February 04, 2022, 11:40:55 AM
Hi,

Tools->Server Console type 'show sessions' if that hits 128 concurrent sessions for some reason it will feel like slow loading since it is waiting for free session slots.
#59
General Support / Re: ODBC
May 26, 2021, 02:54:30 PM
of course like 99% of the time when you post question you find the answer.
I read the doumentation wrong "(not used by ODBC driver)." is only DBName not DBPassword like i first thought, moved password from odbc to netxmsd.conf and now it works.
#60
General Support / ODBC
May 26, 2021, 02:42:26 PM
Hi,

I am moving server from windows to linux since i want to run it in docker.
I managed to create a docker image with ODBC driver and and Linux ODBC Driver 17 for SQL Server from Microsoft and i am having problems connecting to database.
I have deduced that my problem is that you cannot have user/password in the DSN setting you can only send password in connection string, the only solution other then this is setting up Kerberos which i have no experience of.

So my question is it in any way possible to set username/password in netxms that is sent to ODBC or is it 100% relying on ODBC internal mechanics?

I would really like to use MS SQL since that is what i have most experience with and already have good backup and maintenance on it.