Coder Social home page Coder Social logo

gongxun0928 / api-routerd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tsdey/api-routerd

0.0 2.0 0.0 2.69 MB

REST API based Monitoring and System/Network Management

Home Page: https://restgw.github.io/api-routerd/

License: Apache License 2.0

Makefile 0.67% Go 99.33%

api-routerd's Introduction

N|Solid

REST API based Monitoring and System/Network Management

Build Status CircleCI Build Status HitCount CodeFactor Go Report Card License Coverage Status

api-routerd is a cloud-enabled, mobile-ready, a super light weight remote management tool which uses REST API for real time configuration and performance as well as health monitoring for systems (containers) and applications. It provides fast API based monitoring without affecting the system it's running on.

  • Proactive Monitoring and Analytics api-routerd saves network administrators time and frustration because it makes it easy to gather statistics and perform analyses.
  • Platform independent REST APIs can be accessed via any application (curl, chrome, PostMan ...) from any OS (Linux, IOS, Android, Windows ...)
  • An iphone app demo using REST APIS . See Source Code .
  • Runs on Rasberry pi.
  • Minimal data transfer using JSON.
  • Plugin based Architechture. See how to write plugin section for more information.

Features!

Feature Details
socket activation supports systemd socket activation
systemd information, services (start, stop, restart, status), service properties for example CPUShares
networkd config (.network, .netdev, .link)
hostnamed set hostname
logind (list-sessions, list-users and terminate-user etc)
timdate set time, zone
nameserver add/delete/modify /etc/resolv.conf
timesynd set configs
systemd-machined see info about images/machines. start stop machines
journald journald.conf
systemd conf system.conf
coredumpd coredump.conf
systemd-resolved systemd-resolved.conf
kernel modules (modprobe, lsmod, rmmod)
network via netlink . Link: mtu, up, down, Create bridge and enslave links, Create bond and enslave links, Adddress: Set, Get, Delete, Gateway: Default Gateway Add and Delete
group add/delete/modify
users add/delete/modify (requires newuser)
sysctl add/delete/modify and apply
see information from /proc fs netstat, netdev, memory and much more
configure /proc/sys/net (core/ipv4/ipv6), VM
ethtool see information and configure offload features
firewalld see and configure firewalld
See confs sudoers and sshd conf

api-routerd JSON APIs

Refer spreadsheet APIs

Tech

api-routerd uses a number of open source projects to work properly:

Development

Want to contribute? Great!

Installation

First configure your $GOPATH. If you have already done this skip this step.

# keep in ~/.bashrc
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export OS_OUTPUT_GOPATH=1

Clone inside src dir of $GOPATH. In my case

$ pwd
/home/sus/go/src

Installation

$ go get github.com/RestGW/api-routerd
$ git clone https://github.com/RestGW/api-routerd
$ cd api-routerd
$ pwd
/home/sus/go/src/api-routerd
$ go build -v

$ sudo ./api-routerd
INFO[0000] api-routerd: v0.1 (built go1.11.4)
INFO[0000] Start Server at 0.0.0.0:8080
INFO[0000] Starting api-routerd in plain text mode

How to configure IP and Port ?

Conf dir: /etc/api-routerd/ Conf File: api-routerd.toml

$ cat /etc/api-routerd/api-routerd.toml
[Network]
IPAddress="0.0.0.0"
Port="8080"

How to configure users ?

Add user name and authentication string in space separated lines

# cat /etc/api-routerd/api-routerd-auth.conf
Susant secret
Max bbbb
Joy ccccc

How to configure TLS ?

Generate private key (.key)

# Key considerations for algorithm "RSA" ≥ 2048-bit
$ openssl genrsa -out server.key 2048
Generating RSA private key, 2048 bit long modulus (2 primes)
.......................+++++
.+++++
e is 65537 (0x010001)

openssl genrsa -out server.key 2048

Generation of self-signed(x509) public key (PEM-encodings .pem|.crt) based on the private (.key)

$ openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:

Place server.crt and server.key in the dir /etc/api-routerd/tls

[root@Zeus tls]# ls
server.crt  server.key
[root@Zeus tls]# pwd
/etc/api-routerd/tls

Use case: https

$ curl --header "X-Session-Token: secret" --request GET https://localhost:8080/api/network/ethtool/vmnet8/get-link-features -k --tlsv1.2

Use cases

Refer usecase document use cases

How to write your own plugin ?

api-routerd is designed with robust plugin based architecture in mind. You can always add and remove modules to it with minimal effort You can implement and incorporate application features very quickly. Because plug-ins are separate modules with well-defined interfaces, you can quickly isolate and solve problems. You can create custom versions of an application with minimal source code modifications.

  • Choose namespace under cmd directory ( network, proc, system etc) whare you want to put your module.
  • Write sub router see for example api-routerd/cmd/system/login
  • Write your module module.go and module_router.go
  • Write RegisterRouterModule
  • Register RegisterRouterModule with parent router for example for login registered with RegisterRouterSystem under system namespace as login.RegisterRouterLogin
  • See examples directory how to write on your own plugin.

Todos

  • Write Tests
  • networkd
  • iptables

License

Apache 2.0

api-routerd's People

Contributors

codacy-badger avatar ssahani avatar tsdey avatar

Watchers

 avatar  avatar

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.