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

Topics - Millenium7

#21
General Support / Can't use multiple functions in script?
December 11, 2019, 06:16:49 AM
This is not working

I create this as a script called SetInitialAttributes, it compiles and saves just fine no errors
// Set initial device attributes
// If an attribute does not exist, will create it with -1 as value
// If attribute already exists, will not change it


sub AirFiber()
{
if (GetCustomAttribute($node,"TestVar1") == null) SetCustomAttribute($node,"TestVar1",-1);
}

sub AirMax()
{
if (GetCustomAttribute($node,"TestVar2") == null) SetCustomAttribute($node,"TestVar2",-1);
}


Then I try and execute a function. I start off by testing with this

use SetInitialAttributes;
AirFiber();


Works fine

Then I try

use SetInitialAttributes;
AirMax();


And I get "Error 1 in line 13: Data stack underflow"
I tried switching the functions around so that AirMax() is on top i.e.

// Set initial device attributes
// If an attribute does not exist, will create it with -1 as value
// If attribute already exists, will not change it


sub AirMax()
{
if (GetCustomAttribute($node,"TestVar2") == null) SetCustomAttribute($node,"TestVar2",-1);
}

sub AirFiber()
{
if (GetCustomAttribute($node,"TestVar1") == null) SetCustomAttribute($node,"TestVar1",-1);
}



And it works fine when I call AirMax() because its the first function. But then I try calling AirFiber() and I get the same thing, error on line 13 data stack underflow

Am I doing something wrong? Is it not possible to use more than 1 function in a single script?

edit: I think this might be a bug. If I remove the 'SetCustomAttribute' command from both functions and replace it with something like 'println "test";' then I can run both functions just fine. But if I use 'SetCustomAttribute' in the 2nd function it causes the data stack underflow error. I can place lots of 'SetCustomAttribute' commands in the first function and they all run just fine, but when there's 2+ functions and running it on anything other than the first function causes this error
#22
Is it possible to use custom parameter values, or variables in Thresholds?
Or alternatively if I use a template to apply DCI's, and then manually edit the DCI threshold values on a particular node will it still be linked to the template, or will it convert it to a standalone DCI so that any further changes to the template won't be updated on that node?

I want to be able to use templates for monitoring RSSI and SNR on radio's but enter known baseline's as threshold values
So that i.e. LinkA is installed, we know that the master and slave are both -55db RSSI on install, master has 34db SNR, slave has 28db SNR
LinkB is installed, it's -68db, master has 20db SNR, slave has 35db SNR

Each of these nodes I want different thresholds. If LinkA drops to -60db thats bad, its gone out of alignment, obstruction has gone up, trees have started growing etc. but LinkB would need approx -72db as its threshold, we will never get it to -60db thats not a suitable threshold so I can't apply that for every node. Likewise they all have different known SNR margins. I want to alert for progressive changes over time so we can schedule spectrum scans and pick a new frequency as new radio's go up and cause more interference etc. I want to do this way before the link actually has an issue, not just wait until it starts dropping packets and customers complaining
#23
I don't know how to troubleshoot this. I did have alarms working for a particular DCI but now they are not.
The DCI shows its over a threshold on the 'last values' page, but no alarm is ever generated anymore
Maybe they are stuck in some state and not allowing new alarms to be generated for the DCI (don't know, and don't know how to check this)

Here's the way i've set it up




#24
General Support / CRON schedule doesn't work?
November 29, 2019, 04:15:52 AM
I've created a scheduled task to run a script. I set CRON schedule to 0 * * ? * * * as a test to run the script every minute, but it never runs

Is there something i'm doing wrong? Do I need to turn on CRON scheduling in server options or something?
No problem in the script as it runs fine with one time execution (sends me an email), but if I use CRON it doesn't run at all

NetXMS version is 3.0.2329

Edit: Tried creating a dummy node and adding the script as a polling method with a CRON schedule, that too does not work. Yet setting the polling interval to i.e. 60 seconds works fine. So it seems CRON is completely broken in my instance, or i'm doing something wrong that i'm just not seeing
#25
Experimenting with template graphs (have never used them before). I've created one with a regex expression as the template source, right clicked on a node and chose graph->test and it simply says
"Get last values of [node name] has encountered a problem
Not possible to get last values for [node name]: Invalid thread access"

Does this with any node I choose to apply the graph to. Even tried getting rid of the template sources entirely so its just a blank graph, still does the same thing. Can't use graphs on anything
Have checked my user profile and I have full privileges to everything
#26
I see this as an option in event processing policy but I have absolutely no idea how it works because you can't enter a time, you can only enter a text string

Can someone explain how this works and how to use it?
I have some alerts that I would like to automatically resolve/terminate after say 6 hours, then reset and if the issue re-occurs it will once again trigger the alert event
Or creating sticky alerts for some thresholds i.e. if temperature is >60c then do an normal event where if it goes <60c it terminates the alarm
But if it goes >70c then execute a different policy that will not automatically cancel even if temp goes <60c. But this alarm will automatically terminate in 72 hours (freak occurance that doesn't happen again, but gives plenty of time to see an alarm is still there and investigate manually)

It seems like a 'timer cancellation' could easily achieve this but........... no way to enter a time????
#27
Here's an example image


The DCI is added to a node (in this case by a template but can also be manually added) and its working perfectly fine. Yet when I try and select it from a list i.e. making a network map/graph/dashboard/anything where I can choose a DCI, an entry sometimes just will not show up at all. Only way I found to fix it was to remove the DCI and re-add it again. But this causes me to lose all existing polled data
And even then sometimes it doesn't work and I have to actually duplicate a DCI, the duplicate will show up but not the original

I've had this issue periodically for years, and when it happens its frustrating as I need that data, sometimes its data thats been silently collecting for months and then I need to put it into a dashboard but am unable to
If I manually go to the node and then last values tab, right click and choose 'graph' the data is shown just fine. And if I right click on that graph and choose properties->data sources I can see its in there. But if I choose 'add' and browse to the node, that DCI still does not show up

Is this a known issue?
I propose a short-term workaround if it can't easily be fixed: Allow manually typing in the object number of a DCI instead of having to browse to the node and choose it. Maybe then it'll pick it up and at least allow me to add the data source, even if I have to go and look it up manually
#28
General Support / Any way to space out link lines in map?
November 07, 2019, 06:34:32 AM
Is there any way to further space out the link lines in Maps between nodes?
Just creating 2 links they are placed only a couple pixels apart from each other, therefore it makes it impossible to read both labels
Alternatively can I change the position of the DCI labels so they are higher/lower? That way I could fit in data for primary and backup links
#29
I made a thread about this a while ago but can't find it
My understanding was NetXMS builds L2 topology maps by looking at MAC addresses on a port, but it has a restriction that the port must only contain 1 MAC address. This means its impossible to build a L2 topology map if there are wireless links because at minimum there will be 3 (other device/switch, AP and SM radios)
The vast majority of our network is wireless hence L2 topology has been useless to me. But i'd like the ability to use it and create from a seed router in our network and see the links that connect to all other directly connected switches/radios coming off it

And i'd also like to use a separate instance of NetXMS to map out unknown networks that contain wireless links between buildings etc

I have no idea how hardcoded the current implementation is. But it would be nice if we could override this behavior in server configuration, or on a map-by-map basis so any additional MAC addresses on a port are shown. Or if node for that MAC is not known just add all extra ones as a ? symbol
I.e
SwitchA
   |
? (MAC of AP AND SM)
   |
SwitchB
  /        \
Node1  Node2

That is much more useful than using SwitchA as seed and nothing at all shows up. And SwitchB only shows Node1/Node2
#30
I'm confused. Has something drastically changed with how instance discovery works for template DCI's?

I've followed this guide https://lasiszm.wordpress.com/2017/10/22/netxms-template-for-monitoring-mikrotik-interfaces/ as a baseline
Except 2 problems, First is EVERY interface is being added as a DCO
And the second is the names are wrong. Everything just has instance number next to it, i.e. instead of "testRx - ether1" it just shows "testRx - 1" and so on for each

Then I find the discovery filter script just isn't working at all. I literally place this as the first line "return false;" and it STILL adds every single interface.............. what the hell?

edit: Ok I think there's a bug. If I have any 'and' or 'or' statements in IF statements anywhere, it seems the result will always return true, even if the very first line of the discovery script is "return false;"

This works fine
transport = CreateSNMPTransport($node);
if (transport == null) return false;

ifName = SNMPGet(transport,".1.3.6.1.2.1.2.2.1.2.".$1);
ifType = SNMPGet(transport,".1.3.6.1.2.1.2.2.1.3.".$1);
ifMAC = SNMPGet(transport,".1.3.6.1.2.1.2.2.1.6.".$1);
// If could not retrieve values, return false
if (ifName == null) return false;
if (ifType == null) return false;
if (ifMAC == null) return false;

// If interface type is 1/other (VPLS shows as this) and MAC begins with 02
if (ifType->value == 1) return %(true,$1,ifName->value);


but this does not

transport = CreateSNMPTransport($node);
if (transport == null) return false;

ifName = SNMPGet(transport,".1.3.6.1.2.1.2.2.1.2.".$1);
ifType = SNMPGet(transport,".1.3.6.1.2.1.2.2.1.3.".$1);
ifMAC = SNMPGet(transport,".1.3.6.1.2.1.2.2.1.6.".$1);
// If could not retrieve values, return false
if (ifName == null) return false;
if (ifType == null) return false;
if (ifMAC == null) return false;

// If interface type is 1/other (VPLS shows as this) and MAC begins with 02
if (ifType->value == 1) && (ifType->value == 1) return %(true,$1,ifName->value);


This is the exact same script, except the last line if doing 2 IF statements, both are exact same values. This script adds every single interface, as if the result was the very first line said "return true;", even if I put in 'return false;" it'll still add every single interface. Also if I try to condense the failure statements to 1 line i.e.
if (ifName == null) || (ifType == null) || (ifMAC == null) return false;
Once again it doesn't matter at all what is in the rest of the script. It's like the whole script fails and it just defaults to 'return true;'
#31
I'm having issues and i'm not sure if its related to the recent update (which has broken a lot of my scripts hence why i'm rewriting a lot of it)

I have this as a script with some debugging in it

// Radio mode check
// First parameter = Node to check
// Second parameter = Vendor ID / Object ID (uses regex expression). Acts as a prequalifier before proceeding
// Third parameter = SNMP OID to check the radio mode, script will return this value
if ($1 == null) {println "Please specify node as first parameter"; return -1;}
if ($2 == null) {println "Please specify Vendor/Object OID as second parameter"; return -1;}
if ($3 == null) {println "Please specify SNMP OID as third parameter"; return -1;}

tempvar = FindObject($1);
println $2;
println tempvar->snmpOID;

// First check for appropriate Vendor ID
if (tempvar->snmpOID ~= $2) {
println "match was made";
println "----";
println $1;
println $2;
println $3;
println "----";
transport = CreateSNMPTransport(tempvar); // Open SNMP Session
if (transport == null) println "Could not open SNMP session" ; return -2; // If can't open session, abort
// Now check if AP or SM
mode = SNMPGetValue(transport, $3);
if (mode == null) println "Failed to retrieve OID $3"; return -3;
return mode;
};
println "Vendor ID not a match"; return -4;


I'm sending this to the server console

exec RadioMode 27560 "(.1.3.6.1.4.1.17713.21.9).*" .1.3.6.1.4.1.17713.21.3.8.2.1.0

First parameter is a nodes object ID
Second parameter is a regex expression that should match the Object ID / Vendor ID which in this case has .39 appended to it (all radio's in this range have a different number but they all begin with .1.3.6.1.4.1.17713.21.9)
Third parameter is the value to check and it should return 1/2/3 depending on the mode that the radio is in (AP/SM/Spectrum Scan)

It's failing at if (tempvar->snmpOID ~= $2) {
It seems to accept it as a regular expression but its like its being treated as a literal string or something. If I instead replace the $2 with the exact same regular expression (typed into the script itself, not taken from a variable) it recognises it as a match and proceeds just fine

I have other issues in this script such as the SNMPTransport seemingly not being created but we'll cross that bridge later
#32
General Support / SMS suddenly missing?
October 10, 2019, 10:17:45 AM
Our SLACK alerts have stopped. I noticed if I go to server configuration I can't find the 2 SMS options in there anymore
Running latest version of NetXMS. Unsure if this broke before or after the upgrade to 3.0
Maybe something got corrupted?


How do I troubleshoot and fix this?
#33
General Support / Threshold ranges possible?
September 30, 2019, 10:22:00 AM
The current threshold options are somewhat limited especially because you can't do 'AND' or 'OR' operations with them
So from what I gather its not possible to do a threshold range? i.e. 'last polled value between 15 and 20'

I have some SNMP values that return -1, 0 or 4,294,967,295 (highest possible value) and I want to create alerts that exclude these
And others return an incorrect value that I just want to discard. I.e. I have temperature alerts set up, anything >70 send a Slack alert, however when its returning 8,500 we've either created a miniature star or the sensor is faulty. As such I don't want to alert on anything >140

Is there a way to do this?
#34
This is a big problem for us at the moment. I've noticed a bunch of devices that I setup for monitoring have changed from port i've manually set (1616) to the default (161) and this changes the device that NetXMS actually monitors

The setup is there's a bunch of small MikroTik routers and DSLAM's behind those routers. The routers have a forwarding rule, anything UDP 1616 forward to the DSLAM on port 161
Both the router and DSLAM therefore share an IP address, but both can be polled via SNMP on different port numbers. The default of 161 for the Router, and 1616 for the DSLAM

This works fine initially but it seems that if a device stops responding for whatever reason, then NetXMS tries the default port number of 161, this then succeeds and it uses that information, screwing up the monitoring as now its polling the router, not the DSLAM
#35
General Support / Does anyone have ZTE MIB files?
September 25, 2019, 09:36:26 AM
Specifically looking for the ZTE 9806H MIB's. But I can't find any ZTE mib's online
I really need the ability to read the temperature off these devices. ZTE directly won't help me for whatever reason
#36
I'm slowly getting more comfortable with NetXMS but unfortunately it can be difficult to find out how to actually implement things at times :( One of these is how to send SSH commands to a device. I've googled and seen this is possible but I can't find any actual examples to help set it up

I want to be able to be able to send commands via SSH to a device. A simple example being I have created a DCI summary table to show MikroTik RouterOS versions. I want to be able to select all that are outdated, right click, choose Tools->MikroTik Commands->Update RouterOS
And in the background NetXMS would connect to the device with SSH and execute '/system package update install'

How do I set this up?
Then once I get the basics working, is it possible to parse more advanced commands via SSH? I.e. using variables so I could choose 'Update RouterOS' but specify a time as a variable and it would send
'/system scheduler add on-event="/system package update install" start-time=$NetXMSTimeVariable'
So the device would update at 3:30am instead of immediately
#37
I find the default of 'NetXMS Agent' annoying and a bit puzzling, as i'm regularly adding OID's to monitor via SNMP but very rarely adding anything specific to NetXMS agent commands. I'm sure most people are in the same boat and its just 1 more step needed to add items
Is it possible to change the default to SNMP or add an option for it in server configuration?
#38
I'm slowly piecing together an Oxidized installation for our environment but I want devices to automatically be discovered and added for backing up configs
Since we use NetXMS it seems most logical to have this handle the source database

Has anyone got either RANCID or Oxidized (I don't mind using either) to integrate with NetXMS to push devices to it?

Oxidized can use a variety of sources such as CSV, HTTP/HTTPS or SQL database. So is there a way to get NetXMS to create any of these (and add/remove devices) for Oxidized to read from?
I need it to export device name, IP address, device model and optionally username/password (i'm totally fine with creating this as an additional attribute on the object in NetXMS)
#39
I've done a google search, there are some really old topics but not sure if they apply

Essentially I just want to be able to clear old data. For instance I don't care about DCI data older than 30 days at the moment (current retention is set to 60 days)
Is there a way to delete all DCI data older than 30 days?

Same thing for Syslog. Can I delete all old data and/or filter it and delete all data matching certain terms?
I've turned on debugging for a few devices and they have added a lot of syslog entries, can I delete everything matching the term 'debug' for instance?
#40
I have plenty of OID's that are polled with numeric status codes i.e. Duplex 0=half 1=full and I like to use transformation to make this easier for people to read at a glance. So i'll set the value to String and use DCI transformation to say "Half" or "Full" instead of just 0/1.

The problem though is I lose the ability to graph. Graphs are super handy to spot changes over a broad period of time. If I leave it as an integer then I can just graph it, set period to a month and instantly see if the link if ever went into half duplex mode. Really hard when it's a string because I have to look at the DCI distory and try and spot a change in the list of thousands of poll entries

I'm sure there's a way to do this specifically for the 'Duplex' status but I have plenty of others i.e. GPS sync status that can have 6 different codes. Nobody is going to memorize what each code is. I do write them in the comments field of each DCI but it's several more steps to look this up

What i'd like is for when just looking at the objects 'last values' area it could show something in human readable text, but is still an integer in the database so it can graph it