Welcome, Guest. Please login or register.

Author Topic: nam2loc help please  (Read 1626 times)

primethios

  • Newbie
  • *
  • Posts: 3
    • View Profile
nam2loc help please
« on: August 24, 2022, 06:17:15 am »
can anyone explain the name2loc pattern in nedi.conf?

# Using name pattern to map location
;nam2loc   ^(\w+)-(\w+)-(\w+)-(\w+)   $2;$3;$4

routers/switches/wap names follow a standard schema like this "PMH-SWH-84D-234-111"  which stands for PMH=facility - SWH=switch - 84D=IDF location/name - 234=subnet - 111=last octet of static IP of the device (device IP would be 10.128.234.111).  Can anyone help point me to how to utilize the nam2loc pattern. 

I just don't work programming enough to understand how to apply the pattern but trying to show nedi to the higher ups and they would like to see how the topology piece could look as well as grouping devices based on physical location (IDF/MDF).  Unfortunately they have standardized on a SNMP schema that does not fit the nedi expected county;state;city etc but they do use the SNMP location as part of standard alerting and such so I am hoping the nam2loc would help alleviate this issue without creating a handbuilt seedlist that continually needs to be updated.

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2903
    • View Profile
    • NeDi
Re: nam2loc help please
« Reply #1 on: August 24, 2022, 11:02:42 am »
The pattern should work, but use this for a mapping on every IP:
Then $2 refers to the 2.match, $3 to the 3rd etc.

mapn2l   default   ^(\w+)-(\w+)-(\w+)-(\w+)   $2;$3;$4
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

primethios

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: nam2loc help please
« Reply #2 on: August 25, 2022, 02:07:36 am »
Thanks much.  It wasn't exactly what I was hoping for but was able to tweak it enough that I think it will do about the same as I had hoped.  Plus I didn't know that nam2loc was replaced with mapn2l.  I am a network guy not a programmer so it takes me quite a bit of trial and error.  Two questions that go along with this:

1. as I was testing various versions of the expression to get the location to match what I was attempting manty devices got picked up in a scan and now have their locations displaying with results of one of my improper regex expressions.  When I full scan that device again I see in the output that it is applying the previously save name to nam2l expression and won't update with the new expression.  The only way I can get one of those to change is to delete and re-discover.  So is there another database or call that needs to be cleared out or am I stuck with a start from scratch discovery?  I made a clone of the box and tried figured I would try to reset the db but I get all kinds of errors including that admin doesn't have rights to reset the db.  So I am debating if I should just build it all from scratch and give up everything I have pulled so far.

2.  I didn't use common sense that this would likely overwrite the SNMP location shown in NeDi.  Is there a way to still show the SNMP location via the device status view (maybe a defed option or something) or I am just stuck with entering a sysobid in the "optional" field when applying a search?
lastly,
I am trying to build this to show a site that NeDi can do more than openview and others for a much more cost effective price as I think they would benefit from some of the options in the paid support version.  Specifically cable management but I have never had the chance to use the "extra" features.  Is there any documentation, videos, screenshots, etc of the extras?  They have some crazy fiber cross connects I think that this could help keep everything handy in one location and update without going through visio and excel page after page.

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2903
    • View Profile
    • NeDi
Re: nam2loc help please
« Reply #3 on: September 03, 2022, 09:27:00 am »
That changed with 1.5 (so 7 years ago). If you map the location, the original is scrapped...
Have a look at the NeDi Guide here: https://www.nedi.ch/pub/The%20NeDi%20Guide.pdf
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

primethios

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: nam2loc help please
« Reply #4 on: September 04, 2022, 01:55:03 am »
Thanks much.  Trying to get this group to see where NeDi can help them long term.  It's the old game of this does 90% of what they want and need but they are tied up on the 10% like that is the most important part of things. 

For anyone who may be interested, here is how I was able to map/group devices (about 70-75%) so now I am just working on figuring out how to group things where the name doesn't fit the majority of the sites.

PMH-85B-SWH-128-223 as an example
 String:
mapn2l                 default                 ^(\w+)-(\w?)(..)-(\w+)-(\w+)-(\w+)           "$1;NODE_$2;$2$3;"

that creates the "snmp location" in NeDi as below which falls under Remo's design of country, state, city, etc since country and state are useless to our needs.
PMH;NODE_8;85B;

Need to figure how to deal with
PCH-442A-SWH-034-232
At the same time.  I am sure there is a regex carrier I don't know about but for the fact 70%+ of the devices follow the xxx-xxx-xxx-xxx-xxx naming (name points to site, node, IDF/MDF, switch/router/wap/wlc/etc, vlan).  By doing this seeing how NeDi auto-groups devices is very interesting and kinda helpful, it is too bad Remo's design of country,state,city,etc in SNMP location is the basis as that inhibits us from using the currently needed location information (door numbers, access numbers, etc).

This is really the first time I have gone to use NeDi for more than discovery or Cisco backups so it is really interesting to see how NeDi has grown