Skip to content
/ nitr Public

💻 Nitr is a System and Hardware Inspection and Monitoring Web API.

License

Notifications You must be signed in to change notification settings

bitcav/nitr

Repository files navigation



Nitr

go Build Status Release Go Report Card MIT license

Nitr

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/bitcav/nitr/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/bitcav/nitr.git

Build

cd nitr
go build

🚀 Running

Linux

./nitr

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

nitr.exe

the server will start listening on port 8000 by default

app

🔳 Available Commands

Help:

nitr -h

Change Password:

nitr passwd

Get api key:

nitr key

Print Qr Code:

nitr qr

🐳 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 password: 123456

preview

QR Code

The QR Code contains the exact same information displayed in the Host Info Panel formatted as JSON.

⛏️ Usage

Requesting system info with HTTP Get Method through the API endpoints passing the "x-api-key" header with your api key as value and you will get success response.

Example:

  • Requesting CPU Information.

With Curl.

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

With Powershell.

 Invoke-RestMethod -Uri 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
	]
}

API v1

Root Endpoint

http://localhost:8000/api/v1

📡 Available Endpoints

These endpoints allow you to get System and Hardware information about your host. Check the example for a better understanding.

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
GET /memory Memory

🔍 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
clockSpeed float Clock Speed in Mhz
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

🔒 Requires running nitr with elevated privileges

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

🔒 Requires running nitr with elevated privileges

JSON Object

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

Product

🔒 Requires running nitr with elevated privileges

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

Memory

🔒 Requires running nitr with elevated privileges

JSON Array of Objects

Key Data Type Description
bank string Bank Identifier
size integer Size
unit string Unit (KB or MB)
type string Type
formFactor string Form Factor
manufacturer string Manufacturer
serial string Serial Number
assetTag string Asset Tag
partNumber string Part Number
speed integer Speed in MT/s
dataWidth integer Data Width in bits
totalWidth integer Total Data Width in bits

🔧 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
  • gopsutil - psutil for Golang
  • ghw - Golang HardWare discovery/inspection library
  • go-smbios - Detection and access to System Management BIOS