nitr-agent

command module
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 40 Imported by: 0

README



Nitr

go Build Status Release Go Report Card MIT license

Nitr is a cross-platform remote monitoring tool written in Golang for system information gathering, making it available through a JSON API.

The main purpose of this project is to provide highly available data of CPU, RAM, Disks, Network, Processes and so on, to make use of them in applications such as web administration panels or mobile apps.

Nitr

curl + jq demo

Table of contents

Installation

Download

https://github.com/juanhuttemann/nitr-agent/releases/latest

Building from source

Note: go version 1.13 or higher is required building it from the source.

Clone
git clone https://github.com/juanhuttemann/nitr-agent.git
Build
cd nitr-agent
go build

Running

Linux

./nitr-agent

Windows You can double click the .exe file or type in cmd

nitr-agent.exe

the server will start listening on port 8000 by default

app

Docker

Build image using command:

docker build -t nitr . 

Run container:

docker run -d -p 8000:8000 nitr:latest
Web Panel

Go to http://localhost:8000 in your web browser

preview

Access with default username and password: admin admin

preview

Usage

Call the API endpoints with ?key=yourapikey in the URL or pass the x-api-key header with your api key as value and you will get success response.

Examples:
  • Requesting CPU Information.

In the terminal.

curl -X Get 'http://localhost:8000/api/v1/cpu' -H 'x-api-key:yourapikeyhere'

JSON Response:

{
	"vendor":"GenuineIntel",
	"model":"Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz",
	"cores":4,
	"threads":8,
	"frecuency":3800,
	"usage":8.354430379674321,
	"usageEach":[
				9.803921568623954,
				7.692307692348055,
				4.166666666635087,
				4.166666666698246,
				6.122448979565321,
				6.12244897961267,
				4.081632653074482,
				5.88235294118696
	]
}
  • Requesting Host Information.

In the web browser.

http://localhost:8000/api/v1/host?key=yourapikeyhere

preview

API v1

Root Endpoint
http://localhost:8000/api/v1
Available Endpoints

These endpoints allow you to get system and hardware information about your host.

Verb Endpoint JSON Data
GET /cpu CPU
GET /bios Bios
GET /bandwidth Bandwidth
GET /chassis Chassis
GET /disks Disks
GET /drives Drives
GET /gpu GPU
GET /isp ISP
GET /network Network
GET /processes Processes
GET /ram RAM
GET /baseboard Baseboard
GET /product Product

JSON Data References

CPU

JSON Object

Key Data Type Description
vendor string CPU Vendor
model string CPU Model
cores integer Amount of CPU cores
threads integer Amount of CPU threads
usage float CPU usage percentage
usageEach Array of float Usage percentage per CPU
Bios

JSON Object

Key Data Type Description
vendor string Vendor
version string Bios version
date string Bios last update
Bandwidth

JSON Array of Objects

Key Data Type Description
name string Network Interface name
rxBytes integer Amount of bytes received
txBytes integer Amount of bytes sent
rxPackets integer Total packets received
txPackets integer Total packets sent
Chassis

JSON Object

Key Data Type Description
type string Type
vendor string Chassis vendor
serial string Chassis serial
Disks

JSON Array of Objects

Key Data Type Description
mountPoint string Drive Letter or Mount Point
free integer Available disk space in bytes
size integer Total disk space in bytes
used integer Used disk space in bytes
percent float Disk usage percent
Drives

JSON Array of Objects

Key Data Type Description
name string Drive name
type string Drive type
model string Drive model
serial string Drive serial
GPU

JSON Array of Objects

Key Data Type Description
brand string GPU Brand
model string GPU Model
ISP

JSON Object

Key Data Type Description
isp string Internet Service Provider
ip string Public IP Address
lat string Location Latitude
lon string Location Longitude
Network

JSON Array of Objects

Key Data Type Description
name string Network Interface name
addresses Array of string IPv4 and IPv6 list
mac string MAC Address
active boolean True if the Network Interface is Up
Processes

JSON Array of Objects

Key Data Type Description
pid integer Process ID
name string Process Name
Ram

JSON Object

Key Data Type Description
total integer Total RAM in bytes
free integer Free RAM in bytes
usage integer Used RAM in bytes
Baseboard

JSON Object

Key Data Type Description
vendor string Baseboard vendor
assetTag string Asset Tag
serial string Baseboard serial
version string Baseboard Version
Product

JSON Object

Key Data Type Description
vendor string Product vendor
family string Product family
assetTag string Asset Tag
serial string Product serial
uuid string Product UUID
sku string Product SKU
version string Product Version

Settings

The following settings are located in the config.ini file

Server Port

By default, the web server starts on port 8000.

port: 3000
Open Browser on Startup

If true, opens your default web browser on server startup.

open_browser_on_startup: true
Enabling Logs

If true, logs are saved in nitr.log file, otherwise logs are printed out to console.

save_logs: true
Enable SSL

If true, server starts using HTTPS protocol. Certificate and Key must be provided

ssl_enabled: true
ssl_certificate: /path/to/file.crt
ssl_certificate_key: /path/to/file.key

Platform Support

Windows

Tested:

  • Windows 10
  • Windows 7 SP1

Linux

Tested:

  • Ubuntu Linux 20.04 LTS
  • Debian Linux 10
  • Manjaro Linux 20

Powered by

  • Fiber - The web framework used
  • bbolt - Database
  • UIKit - Front-End framework

Documentation

Overview

Code generated by rice embed-go; DO NOT EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL