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 - meshnet

#1
I wanted to follow up on how we fixed it.

The radio devices have SNMP for virtual AP interfaces. We don't really care about these OIDs, plus they are all unique across formfactors/firmwares. So the trick is to use a working SNMP OID endpoint, poll it, then use a transformation script to replace the value.

Example for geoLatitude_DMS:


nodeLoc = $node->geolocation;
return nodeLoc->latitudeText;

#2
General Support / Re: Standby Server DB Replication
January 23, 2019, 09:39:46 PM
i would down netxms daemon, then run nxdbmgr -d -f check

restart netxsd daemon, did it fix anything? no? down netxms daemon again.

enter your mysql console, and use the netxms database

then, remove that duplicate entry with a mysql query

Quotedelete from netxms.event_log where event_id = 26022462;

exit, 'check' netxms database, restart netxms daemon, if a similiar issue occurs for what seems like infinity, you can repeat, or clear out the table with truncate netxms.event_log
#3
Well, the post pretty much answers itself. Without an 'entire network' object/container, all nodes end up being bound/binded to Infrastructure Services.

So... Also wrote a script (first draft, you should optimize this or add it to another Hook:: script for efficiency) to block unwanted auto-discovery networks. This tremendously helps anyone create Layer-3 IP generated NetXMS Maps by removing 'common' subnets such as 192.168.88.1 or 192.168.20.1 or 169.254.0.1 etc..

So Here's the script, it does a few simple things but most importantly removes any 'unwanted' networks from the 'Entire Networks' container/zone

How can this script be improved? Should it exist in configuration? Or in Hook::AddNode? (is that it?)

It's been hand edited/cleaned up, and untested.. so please don't run this on production without reviewing everything it does.



sub main()
{

    $logo = "Hook::ConfigurationPoll ";
    trace(1, $logo . "Review and Edit this hook script dummy!");
    return;
    //
    // Rename if Null (For say, Netonix PoE switches)
    //
    if (($node->snmpSysName != null) && ($node->snmpSysName != "")) {
      if ($node->name != $node->snmpSysName) {
        RenameObject($node, $node->snmpSysName);
      }
    }

    //
    // Shut SNMP polling off for Agents, and vice versa.
    //
    if ($node->isAgent == 1) {
      $node->enableSnmp(false);
    } else if ($node->isSNMP == 1) {
      $node->enableAgent(false);
    }

    $only_allow_example_address = "10.69.0.0";
    $only_allow_example_subnet  = "255.252.0.0";

    interfaces = GetNodeInterfaces($node);

    foreach(iface : interfaces) {

        addrList = iface->ipAddressList;
        //
        // Nuke interfaces which do not have an IP address. Some devices may have 4,000 VLANs created by default.
        //
        if ((addrList[0] == null) && (iface->status == managed_status_code)) {
            trace(1, $logo . "(" . string($node->name) .") No IP addresses on interface -- UNMANAGED: " . string(iface->name) );
            UnmanageObject(iface);
        }

        $i = 0;
        foreach(ip : addrList) {
          $i = $i + 1;

          trace(1, $logo . "addrList[" . iface->name ."]:: " . $node->name . " - #". $i ." ". ip->address);

          $is_example_address_valid = AddrInSubnet(ip->address, $only_allow_example_address, $only_allow_example_subnet);

          if ($is_example_address_valid == false) {

              trace(1, $logo . "Unwanted ip address found: " . ip->address);
              parents = GetNodeParents($node);
           
              foreach(p : parents) {
                if (p->type == 1) {

                  $is_node_subnet_valid = AddrInSubnet($ipAddr, $only_allow_example_address, $only_allow_example_subnet);
                  $is_example_address_valid = AddrInSubnet(ip->address, $only_allow_example_address, $only_allow_example_subnet);
     
                  //
                  // While iterating, we stumbled on and are now removing: Unwanted Subnet in Object: " . p->name . " @ id #" . p->id . " (" . p->type . ")" );
                  //
                  if ($is_example_address_valid == false) {
                    DeleteObject(FindObject(p->id));
                  }

                  //
                  // Found exact and unwanted Subnet in Object: " . p->name . " @ id #" . p->id . " (" . p->type . ")" );
                  //
                  $this_ip_in_subnet_object = AddrInSubnet(ip->address, p->ipAddr, "255.0.0.0");
                  if ($this_ip_in_subnet_object) {
                    //
                    // This is where you can run p->setExcludeFromTopology(true);
                    //
                    DeleteObject(FindObject(p->id));
                  }


                } // end if: (type == subnet)
              } // end of foreach: parents->GetNodeParents(node)
          }
        } // end foreach: iface->ipAddressList


    } // end foreach GetNodeInterfaces

} // end Main



#4
Good day,

I would be grateful for a feature to toggle (via button or with a key-combo) how maps are navigated with the keyboard & mouse

example:

control + mousewheel up
  - map zooms in

control + mousewheel down
  - map zooms out

control + left click drag
  - pans map in any direction

alt + left click drag
  - selects rectangular area where map is centered and zoomed in

#5
Quoteon the node use an internal  DCI of type Dummy that return a string

yes, that works for some values and for some cases. But for summary tables it, it may be asking too much for a per-object and/or per-dummy field. You can see here in the screenshot the dummy values column holds values which are all over the place.

Process
- automatically/manually collect GPS coords (LAT/LON) for a given device
- take above GPS coords, install via: right-click object -> properties -> Location -> (Latitude / Longitude)
- Apply, and perform re-poll on device (or wait a bit)

DCI Transformation
- create 2 DCIs for both Latitude and Longitude and enter Transformation script
- no delta calculation

Latitude

nodeLoc = $node->geolocation;
return nodeLoc->latitude;


Longitude

nodeLoc = $node->geolocation;
return nodeLoc->longitude;



This works great when collecting all nodes, plus their last values -- This works correctly saves time because of code that filters for Jython code, where node.isWireless() then simply continue to aggregate a list of nodes and last-values. simple.

The issue is summary tables.. It would be great to have this work there, vs. other methods.


#6
General Support / Re: GPS Directly from SNMP?
November 20, 2018, 09:42:10 PM
I've found a scripting example here:

https://wiki.netxms.org/wiki/Script_Example:_Setting_node_geolocation_from_SNMP

It reads

Adjust the OIDs in SNMPGetValue as required.

transport = CreateSNMPTransport($node);
if (transport == null) {
  return null;
}

lat = SNMPGetValue(transport, ".1.2.3.4.1");
long = SNMPGetValue(transport, ".1.2.3.4.2");

if (lat == null || long == null) {
  return null;
}

geoLoc = GeoLocation(lat, long);
$node->setGeoLocation(geoLoc);

return 0;
#7
Good day Victor,

Quoteare they duplicated within single subnet? If yes, can you please share screenshots of "Overview" and "Interfaces" tabs for few such devices?

So the first thing I should point out is the container 'Entire Network' has never existed. I'm fairly certain it was removed for a specific reason. Perhaps it was removed from the database. I don't know how it was done, but I'd like more information as to how it was removed and if possible, I beg of you, any issues this may be causing.

Thanks for any help/thoughts on this.

Notes
- interface alerts (expected state UP or DOWN and IGNORE) are tagged on discovery with script: Hook::ConfigurationPoll
- in interfaces, the z_icmp_... interface is the devices primary (shortest-path) uplink, alert focus is for these ports/addresses
- if z_icmp... is down, the object turns RED but may be accessible over other networks (mesh topology w/ ospf)
- object-id are different for tentcity-1 and tentcity-2, yet, it is the same device.

Meta-Notes
- I've been upgrading the daemon and migrating it's database for ~3 years and not a single hiccup.
- Keep on kicking ass!

#8
Quote from: Victor Kirhenshtein on July 16, 2018, 02:45:00 PM
Hi,

you should downgrade your Java to version 8 update 151. version 8u161 is known to be causing this issue.

Best regards,
Victor

Thank you!! I will pass this along!
#9
sorry but logging in as root is as 'just works' enough for me not to use os x.. sigh..

come to find out, installing a brew version work? but... i need more information may be someone has got it to work. In the mean time i am supporting users via webgui.

webgui is definitely 'just works' for us

Dockerfile

FROM jetty:9-jre8
EXPOSE 8080
ADD https://www.netxms.org/download/webui/nxmc-xxxxxxxxxxxx.war /var/lib/jetty/webapps/ROOT.war
ENTRYPOINT ["--modules=jmx jetty.threadPool.maxThreads=500"]

#10
Hello,

I have physical devices found through network discovery. The main issue is multiple objects are created. The device may have 10 interfaces with 10 different subnets. The result is 10 objects. This is detrimental at scale. The impact is now SNMP Polling and NetXMS Database, Severe Events and so on, are now 10 times in size. Of the thousands of devices, it is now ~5 thousand the impact.

I assume the method of preventing this is adding a NetXMS script to match device name to an existing device name. Is this an efficient way to go about this? Also, is there a way to clean up it's current state (thousands of devices) -- I am thinking I will write a NetXMS + Python script to determine if the nodes are duplicate, are not on a map, and are not holding any custom attributes I may have set. But.. Easier the better, no?

Suggestions, thoughts much appreciated.

Attached is a screenshot of the "issue" -- though, it may not be considered one by some or many admins here.

Kind regards,

-w
#11
looking at the 2.2.x source code in ./netxms/src/agent/subagents/ssh

in here, the handlers.cpp file defines the remote SSH port 22.
Also here are a group of parameters passed into H_SSHCommand()

I am interested in variable/pointer set with this function _tcschr(hostName, _T(':'));



/**
* Generic handler to execute command on any host
*/
LONG H_SSHCommand(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session)
{
   TCHAR hostName[256], login[64], password[64], command[256];
   if (!AgentGetParameterArg(param, 1, hostName, 256) ||
       !AgentGetParameterArg(param, 2, login, 64) ||
       !AgentGetParameterArg(param, 3, password, 64) ||
       !AgentGetParameterArg(param, 4, command, 256))
      return SYSINFO_RC_UNSUPPORTED;

   UINT16 port = 22;
   TCHAR *p = _tcschr(hostName, _T(':'));
   if (p != NULL)
   {
      *p = 0;
      p++;
      port = (UINT16)_tcstoul(p, NULL, 10);
   }



We understand from documentation and from forums to use SSH.Command() -- Is anyone using the alternative port feature? I assume it should be used in DCI collection for Data Parameter (as an SSH origin) with this example:

SSH.Command(100.64.45.218:1916,tiger,lemur,"cat /tmp/run/stats/wireless.json")

Is this accurate? a packet trace reveals port 22 is used :-\


... The command above works for ./bin/nxget but not for DCI collection. For that, i simply enter the command "cat /tmp/run..." but nxms connects to port 22

#12
hello,

the dmg file for 2.2.4 is 404, but i found the .zip in the 2.2/ directory

launching the netxms console works, but the ability to enter user/password or server IP is not possible.

it's unfortunate that os x has these tendencies to fail horribly, yet still holds the 'it just works' motto... when unicode cause kernel panics.. sigh... that mottos falls in to the trash very quickly re: user root...

Any update as to how to go about fixing this? currently depending on the NetXMS+Jetty (Web) application, which is totally rad...but the features I have in 'Tools->custom->Thing' is not available.

Should I try to have Mac OS users test with ./nxmc -auto -login=someUser -password=somePass -server=someServ.er

I do not know how to launch ncmx from Apple, because it's a directory.. may be somebody could help? or has found a solution?
#13
This looks promising

>>> ColumnFilter(ColumnFilterType.GREATER, 2)
org.netxms.client.log.ColumnFilter@7092fb41


and then previous code becomes

severityFilter = ColumnFilter(ColumnFilterType.GREATER, 2)


re: 4acb63e12d19c7b1633ee803db2eabc5e02e3532
Quote*UPDATED* Type of search in class ColumnFilter should be change to Enum type. fixes #1245

Thank you for contributing and documenting Ēriks Jenkēvics


#14
Hello,

Code:


import java.lang.Integer
import time
import operator
from datetime import datetime as dt

def main():
    date           = dt.strftime(dt.now(), '%Y-%m-%d')
    hourOffset     = dt.now().hour
    eventLog       = session.openServerLog("EventLog")
    severityFilter = ColumnFilter(java.lang.Integer(ColumnFilter.GREATER),2)
    timeFilter     = ColumnFilter(long(time.time()-86400),long(time.time()))
    logFilter      = LogFilter()

    logFilter.setColumnFilter("event_severity",severityFilter)
    logFilter.setColumnFilter("event_timestamp",timeFilter)
    eventLog.query(logFilter)

    eventTable = eventLog.retrieveData(0,500,True)
    print(str(eventTable))

main()



Output / Error


>>> severityFilter = ColumnFilter(java.lang.Integer(ColumnFilter.GREATER),2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'org.netxms.client.log.ColumnFilter' has no attribute 'GREATER'

ColumnFilter Vars

>>> print(str(vars(ColumnFilter)))
{
    '__init__': <java constructor org.netxms.client.log.ColumnFilter 0x2>,
    'numericValue': <beanProperty numericValue type: long 0x3>,
    'getRangeTo': <java function getRangeTo 0x4>,
    'rangeTo': <beanProperty rangeTo type: long 0x5>,
    'setLike': <java function setLike 0x6>,
    'getType': <java function getType 0x7>,
    'operation': <beanProperty operation type: org.netxms.client.constants.ColumnFilterSetOperation 0x8>,
    'setRangeTo': <java function setRangeTo 0x9>,
    'addSubFilter': <java function addSubFilter 0xa>,
    'getSubFilters': <java function getSubFilters 0xb>,
    'getLike': <java function getLike 0xc>,
    'getNumericValue': <java function getNumericValue 0xd>,
    'subFilters': <beanProperty subFilters type: java.util.Set 0xe>,
    'negated': <beanProperty negated type: boolean 0xf>,
    'isNegated': <java function isNegated 0x10>,
    'getOperation': <java function getOperation 0x11>,
    'type': <beanProperty type type: org.netxms.client.constants.ColumnFilterType 0x12>,
    'getRangeFrom': <java function getRangeFrom 0x13>,
    'setOperation': <java function setOperation 0x14>,
    'setRangeFrom': <java function setRangeFrom 0x15>,
    'setNegated': <java function setNegated 0x16>,
    'setNumericValue': <java function setNumericValue 0x17>,
    'rangeFrom': <beanProperty rangeFrom type: long 0x18>,
    'like': <beanProperty like type: java.lang.String 0x19>
}