Giter Club home page Giter Club logo

yanic's Introduction

Yanic

__   __          _
\ \ / /_ _ _ __ (_) ___
 \ V / _` | '_ \| |/ __|
  | | (_| | | | | | (__
  |_|\__,_|_| |_|_|\___|
Yet another node info collector

Test, Lint codecov Go Report Card

yanic is a respondd client that fetches, stores and publishes information about a Freifunk network. The goals:

  • Generating JSON for Meshviewer
  • Storing statistics in InfluxDB or Graphite to be analyzed by Grafana
  • Provide a little webserver for a standalone installation with a meshviewer

How it works

In the first step Yanic sends a multicast message to the group ff05::2:1001 and port 1001. Recently seen nodes that does not reply are requested via a unicast message.

Documentation

Take a look at the git or website

Installation

Take a look into the Documentation (see above) or for Quick Overview in INSTALL.md.

If you like Docker you may want to take a look here.

Configuration

Read comments in config_example.toml for more information.

Running

Yanic provides several commands:

Usage

Run Yanic without any arguments to get the usage information:

Usage:
  yanic [command]

Available Commands:
  help        Help about any command
  import      Imports global statistics from the given RRD files, requires InfluxDB
  query       Sends a query on the interface to the destination and waits for a response
  serve       Runs the yanic server

Flags:
  -h, --help              help for yanic
      --loglevel uint32   Show log message starting at level (default 40)
      --timestamps        Enables timestamps for log output

Use "yanic [command] --help" for more information about a command.

Serve

Runs the yanic server

Usage:
  yanic serve [flags]

Examples:
yanic serve --config /etc/yanic.toml

Flags:
  -c, --config string   Path to configuration file (default "config.toml")
  -h, --help            help for serve

Global Flags:
      --loglevel uint32   Show log message starting at level (default 40)
      --timestamps        Enables timestamps for log output

Query

Sends a query on the interface to the destination and waits for a response

Usage:
  yanic query <interfaces> <destination> [flags]

Examples:
yanic query "eth0,wlan0" "fe80::eade:27ff:dead:beef"

Flags:
  -h, --help        help for query
      --ip string   ip address which is used for sending (optional - without definition used the link-local address)
      --port int    define a port to listen (if not set or set to 0 the kernel will use a random free port at its own)
      --wait int    Seconds to wait for a response (default 1)

Global Flags:
      --loglevel uint32   Show log message starting at level (default 40)
      --timestamps        Enables timestamps for log output

Import

Imports global statistics from the given RRD files (ffmap-backend).

Usage:
  yanic import <file.rrd> <site> <domain> [flags]

Examples:
yanic import --config /etc/yanic.toml olddata.rrd global global

Flags:
  -c, --config string   Path to configuration file (default "config.toml")
  -h, --help            help for import

Global Flags:
      --loglevel uint32   Show log message starting at level (default 40)
      --timestamps        Enables timestamps for log output

Communities using Yanic

Do you know someone else using Yanic? Create a pull request!

Related projects

Collecting data from respondd:

Respondd for servers:

License

This software is licensed under the terms of the AGPL v3 License.

yanic's People

Contributors

aiyionprime avatar andir avatar belzebub40k avatar blocktrron avatar brother-lal avatar citronalco avatar corny avatar dasskelett avatar dependabot[bot] avatar genofire avatar grische avatar kb-light avatar krombel avatar lemoer avatar lrnzo avatar mablae avatar maurerle avatar micw avatar mweinelt avatar myigel avatar neocturne avatar nrbffs avatar rubo77 avatar skorpy2009 avatar xf- avatar zaunei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yanic's Issues

Collect info from multiple interfaces

Hello everyone.

I am currently trying to set up yanic for the Freifunk Aachen community.

In this community we have divided the network into multiple segments to keep the broadcast domain size managable etc. The monitoring server (which does among other tasks nodeinfo collection) has a bridge interface for each of our segments. As the seperation of segments is only a technical and not a social divide, we want to display all nodes from all segments on our map. Until now we used hopglass-server which is able to listen to multiple interfaces at the same time. This is not possible with yanic (Or is it? If so: Problem solved, all that remains is maybe a documentation fix?)

We cannot just bridge all these bridge interfaces together, as this would break stuff on the network side (hazy on the details but I think batman-adv bridge-loop-avoidance gets confused there).

I see the following solutions:

  • Run one instance of Yanic on each of these bridges. A downstream script can then merge together the resulting nodes.json files to have one big file we can feed to our map.
    ** Downside: Having one config file per segment is kind of annoying when one wants to do global changes.
    ** Downside: Yet another work step when adding new segments (setting up a new yanic instance instead of changing e.g. a flag).
    ** Downside: One cannot use convenience features like the built-in webserver etc. anymore
    ** Upside: Would work right now without code changes. Having the merge script upstream would be kind of neat still.

  • Add a configuration option similar to the one in hopglass-server where yanic can collect info from multiple interfaces at the same time.
    ** Downside: No idea how hard this is to implement.
    ** Upside: No additional data-plumbing required, everything should just work for the user.
    ** Upside: Network operators can change segments spontaneously or maybe even in an automated fashion.

If you have other ideas, I am open for input.

Thanks for your consideration!

Store gateway6 in nodes.json

My latest update to gluon-radv-filterd sends MAC address of the selcted gateway via the "statistics.gateway6" attribute. Would be great if that would make it into the nodes.json.

Disclaimer: It hasn't been merged to Gluon yet, so the name of the attribute could change. However, having an overview of whether the feature works by showing the selected gateway in the nodes.json would certainly help merging. 😊

Make tests deterministic

There is a race condition:

--- FAIL: TestStart (0.03s)
        Error Trace:    internal_test.go:51
	Error:      	Not equal: 
	            	expected: 1
	            	actual: 0
        Error Trace:    internal_test.go:55
	Error:      	Not equal: 
	            	expected: 2
	            	actual: 3
FAIL
FAIL	github.com/FreifunkBremen/yanic/output	0.048s

fatal error: concurrent map iteration and write

commit: 9720835

Yanic crashes with the error message "fatal error: concurrent map iteration and write".

Last output: https://gist.github.com/yayachiken/0043ef2b5fd01acc4d17b7f06678f963

No idea what circumstances cause this. It already happened twice though. When restarting, yanic is able to run fine again. Becuase the crash only happened twice now I have no idea how much time usually passes between crashes, but in this case it was a couple of hours.

database slow down collection

It looks like the database (a secound influxdb on my homeserver - ipv6/ssl) slow down the collection and create wrong data.

Request per Unicast before Delete

Du sagst es doch selbst: Du flutest das Netz etwas.

Ab der nächsten Gluon-Version wird es außerdem eine Verzögerung von bis
zu 10 Sekunden bei der Beantwortung von Multicast-Anfragen geben [1], um
diese Netz-Flutung zu vermeiden. Spätestens dann macht es keinen Sinn
mehr, alle 5 Sekunden zu fragen.

Ich würde die Unicast-Nachfrage daher schon sehr begrüßen.

Viele Grüße,
Jan-Philipp

[1]
freifunk-gluon/gluon@9a06a98

Export nproc to time series db

Interpreting load is always relative to the number of CPU cores of the device being monitored. Recently more devices with multiple cores have turned up and meaningful graphs need to take that into account.

Therefore I'd recommend exporting nproc to the time series databases.

Add support for hopglass nodes.json and graph.json

This looks like we finally have a reasonable implementation that provides the code infrastructure to fulfill all tasks. If yanic proves itself stable and useful I will consider dropping hopglass-server development in favor of yanic.

A similar story can be told for the ffrgb-meshviewer, however yanic+ffrgb-meshviewer are missing some features that hopglass+hopglass-server provide. I am currently working on merging all the internal improvements of ffrgb-meshviewer into hopglass while preserving all features.

Required additions to meshviewer nodes.json v2 and meshviewer graph.json to support all features of hopglass:

  • bidirectional links in graph.json (could be reduced to bidirectional tq numbers)
  • link attribute "type" in graph.json is a string that can currently be
    • "fastd" or "tunnel": a fastd vpn link
    • "l2tp": l2tp vpn link
    • "other": a cable / Mesh on LAN / WAN link
  • all airtime data provided by a current gluon master router has to be forwarded to nodes.json
  • nexthop has to be forwarded to nodes.json
  • gateway and nexthop MACs have to be resolved to their nodeids (could be moved to client)

I'll update this issue when I remember another required change or there are new required changes to support all features of hopglass.

HopGlass will probably catch up with your changes before this gets implemented.

Also when ffrgb-meshviewer and all features of hopglass are in one release and yanic supports all those features I see no reason to continue developing hopglass and ffrgb-meshviewer as two projects.

I want a comment from you (@genofire) if you think this is feasable and if you are ready to support these features. A exact format should be agreed on, although as long as it contains all the required data HopGlass can be adapted.

Broken graph.json?

We use Yanic. Our Meshviewer doesn't show the map but an error message (Cannot read property 'forEach' of undefined). It seems the graph.json or nodes.json is broken. Is there any tool to validate this? I could not find the error.

Refactored filters not working properly

I updated our installation to the latest master with the refactored filters but I have some problems with them.

  1. no_owner was renamed to noowner. The documentation still says it should be no_owner.
panic: filter configuration errors: [unknown filter: no_owner]
  1. blacklist and sites complain about invalid configuration but they are defines as shown in the documentation.
[nodes.output.meshviewer-ffrgb.filter]
blacklist = ["98ded0c5e0c0","ec086b6135da"]
sites = ["ffwi"]
panic: filter configuration errors: [unable to initialize filter blacklist: invalid configuration, array of strings expected]
panic: filter configuration errors: [unable to initialize filter sites: invalid configuration, array of strings expected]

Influxdb deletes too much

Config

[influxdb]
enable   = true
address  = "http://localhost:8086"
database = "ffhb"
username = ""
password = ""
# cleaning data of measurement node,
#   which are older than 7d
delete_after = "7d"
#   how often run the cleaning
delete_interval = "1h"

Version
016e2dc

Description
Influxdb lost more then all data after 7 days :(
But this habben just on some nodes not on every one.

privat-genofire

Fix system.domain_code handling

The upcoming gluon version will likely have multidomain support. The nomenclature is that a site is an aggregate of multiple domains.

In addition to site_code the system object in nodeinfo needs to parse the domain_code, which separates different meshes.

I assume it suffices to add the DomainCode here:

SiteCode string `json:"site_code,omitempty"`

// System struct
type System struct {
	SiteCode string `json:"site_code,omitempty"`
	DomainCode string `json:"domain_code,omitempty"`
}

Add editorconfig

Editorconfig allows basic settings for editor (with or without plugins http://editorconfig.org/ ).
Behavior like newline, end of line, indent_style, indent_size for different files.

Error during building webserver part of repond-collector

For golang's version with 1.7 and before it could be fixed with this patch

diff --git a/cmd/respond-collector/main.go b/cmd/respond-collector/main.go
index d40d073..5d4be75 100644
--- a/cmd/respond-collector/main.go
+++ b/cmd/respond-collector/main.go
@@ -57,8 +57,7 @@ func main() {

        if config.Webserver.Enable {
                log.Println("starting webserver on", config.Webserver.Bind)
-               srv := webserver.New(config.Webserver.Bind, config.Webserver.Webroot)
-               go srv.Close()
+               webserver.New(config.Webserver.Bind, config.Webserver.Webroot)
        }

        // Wait for INT/TERM

allow use of self-signed certificates with influxdb

it would be nice to be able to allow self-signed certificates for the database connectors like influxdb

Expected Behavior

the connection should simply work

Current Behavior

there's a panic because of the self-signed certificate

Possible Solution

allow self-signed certificates either by default or by choice

Context

connection to influxdb should be encrypted, without the need for some "official" CA

Your Environment

influxdb 1.5.x
yanic current (what is installed by go get -v -u github.com/FreifunkBremen/yanic)

Remove incomplete geo locations

Now and then we are having nodes with incomplete geo locations.

e.g. one of longitude or latitude is missing completely
missing dot in longitude or latitude

Could yanic remove those incomplete/unrealistic geo locations?

Add more mesh VPN providers

Right now yanic does only recognize meshvpn links from fastd.
It would be nice to support more meshvpn software like tunneldigger or wireguard.

How can we workaround this?

kindly regards

to much free memory

Hey everyone,
Since a few months, I'm working an respondd on our supernodes.
This worked out merely shitty, but got done yesterday.
Except for one server.
As it turns out, that server is the only one of ours having more than 4gb of free ram...

As the logs put it:

Jan 31 16:31:10 the_ yanic[26127]: 2018/01/31 16:31:10 unable to decode response from [fe80::1c3b:e7ff:fee0:414b%bat0]:1001 json: cannot unmarshal number 5932621824 into Go struct field Memory.free of type uint32

I see two options;
but as much as I love the idea to put the internal memory under load in order to make a node pop up in our map, I think it would be more saner to solve this problem in code.

I'm not sure, if it was worth the waste of memory just to show memory stats on a bigger scale with such a high precision. The alternative would be to cap the respondd-client in order to lie about the free memory so that the limit of a uint32 would not be exceeded.

What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.