Skip to content
Collect and save network informations into an Graphdatabase
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
package.json

README.md

Synlan

Synlan is an Application to collect Network informations and save it into an graph database.

  1. Installation
    1.1 Node
    1.2 Neo4j
  2. Configuration
    2.1 general.json
    2.2 neo4j.json
    2.3 locations.json
    2.4 server.json
    2.5 trunkports.json
  3. Usage
  4. API
    4.1 Device Location
    4.2 Devices
  5. License

Installation

Node

Some modules are required to run the application, you need first to install them.
Required modules are written in the package.json under 'dependencies'.
To Install all required node modules execute in the project folder following command:

$ npm install

Neo4j

The last installation step is to download the graphdatabase Neo4j and to install it.
You can download neo4j here.

Configuration

Before running, the application must be configured.
All config files are located under following path:

src/configs/

general.json

IPAM

IPAM (IP Adress Management) tool, used to resolve mac-addresses.

Config example:

{
"IPAM" : "ipam.domain.test"
}

Example of expected return value:

{
    "hostname": "host",
    "mac": "78:92:9C:46:B5:14",
    "ip": "0.0.0.0"
}

SNMP

Iterates over all configured switches.
The iteration returns for each switch all current known devices.
This returns mac-address and port where the device is connected.

example:

{
    "SNMP" : {
        "switches" : [
            {
                "name" : "switch1",
                "url" : "switch1.domain.test",
                "ip" : "0.0.0.0",
                "ports" : 48,
                "trunkPorts": 2,
                "community" : "public"
            },
            {
                "name" : "switch2",
                "url" : "switch2.domain.test",
                "ip" : "0.0.0.0",
                "ports" : 48,
                "trunkPorts": 2,
                "community" : "public"
            }
        ]
    }
}

neo4j.json

To set the Neo4j graphdatabase url, open the json file 'neo4j.json' under 'src/config'.
Replace username and password.

example:

{
  "url" : "http://username:password@localhost:7474/"
}

locations.json

To add locations, add the location to the locationList.
After adding the location you can add individual ports for each room.
If no location and port is given, location is set to UNKNOWN.

example:

{

  "locationsList" : [
    "room1",
    "room2"
  ],

  "locationPorts" : [
    {
      "name" : "A1",
      "room" : "room1",
      "switch" : "switch1",
      "switchUrl" : "switch1.domain.test",
      "port": 10
    },
    {
      "name" : "B1",
      "room" : "room2",
      "switch" : "switch1",
      "switchUrl" : "switch1.domain.test",
      "port": 11
    },
    {
      "name" : "B2",
      "room" : "room2",
      "switch" : "switch2",
      "switchUrl" : "switch2.domain.test",
      "port": 10
    }
  ]
}

server.json

There is a possibility to change the update interval.
The interval is the waiting time (in minutes) before the next script run is executed.
Default update interval is set to 3 minutes.

example:

{
  "updateInterval" : 3
}

trunkports.json

Configuring trunkports for each switch.
Add name and port of the switch.
Add the second switch where the trunk connection goes.

example:

[
  {
    "switch" : "switch1",
    "trunkPort" : 48,
    "secondSwitch" : "switch2"
  },
  {
    "switch" : "switch2",
    "trunkPort" : 48,
    "secondSwitch" : "switch1"
  }
]

Usage

After finishing the configuration, go under following path:

src/

run the application with following command:

$ node Server.js

API

After starting the Server.js a Server is is listening under port 3000.

Device location

You can get the location of an devices by using following url:

localhost:3000/location?hostname=<hostname>

Example response:

[
    {
        port: "8",
        name: "host1",
        mac: "78:92:9C:46:B5:14",
        timestamp: "1507116994633",
        switch: "switch1",
        type: "Device"
    },
    {
        name: "LAN / WLAN",
        type: "DevicePort"
    },
    {
        port: "10",
        name: "A1",
        room: "room1",
        switch: "switch1",
        type: "LocationPort"
    },
    {
        name: "Network",
        type: "SwitchPortRoom"
    },
    {
        name: "8",
        type: "SwitchPort"
    },
    {
        address: "switch1.domain.test",
        ip: "0.0.0.0",
        name: "switch1",
        url: "switch1.domain.test",
        timestamp: "1507116994452",
        type: "Switch"
    }
]

The response returns an array starting with a device and ending with a switch.
The symbolized path looks like:
(device) <- (devicePort) <- (locationPort) <- (switchPortRoom) <- (SwitchPort) <- (switch)

Devices

You can get all devices or filter a single device. To get all devices:

localhost:3000/devices

To search a single device:

localhost:3000/devices?name=<hostname>

Example response:

[
    {
        port: "45",
        name: "printer",
        mac: "00:00:00:00:00:00",
        timestamp: "1507126009521",
        switch: "switch1"
    },
    {
        port: "38",
        name: "pc1",
        mac: "00:00:00:00:00:00",
        timestamp: "1507126009521",
        switch: "switch1"
    }
]

License

MIT License

You can’t perform that action at this time.