Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitcav/nitr
:computer: Nitr is a System and Hardware Inspection and Monitoring Web API.
https://github.com/bitcav/nitr
api bbolt fiber go golang gopsutil hardware inspection json linux monitor monitoring-tool system uikit uikit3 windows
Last synced: 4 days ago
JSON representation
:computer: Nitr is a System and Hardware Inspection and Monitoring Web API.
- Host: GitHub
- URL: https://github.com/bitcav/nitr
- Owner: bitcav
- License: mit
- Created: 2020-05-09T02:44:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T23:01:52.000Z (almost 2 years ago)
- Last Synced: 2024-06-19T10:14:58.479Z (7 months ago)
- Topics: api, bbolt, fiber, go, golang, gopsutil, hardware, inspection, json, linux, monitor, monitoring-tool, system, uikit, uikit3, windows
- Language: Go
- Homepage:
- Size: 39 MB
- Stars: 48
- Watchers: 7
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![go](https://raw.githubusercontent.com/bitcav/nitr/master/images/goversion.svg) [![Build Status](https://travis-ci.org/bitcav/nitr.svg?branch=master)](https://travis-ci.org/bitcav/nitr) ![Release](https://raw.githubusercontent.com/bitcav/nitr/master/images/release.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/bitcav/nitr)](https://goreportcard.com/report/github.com/bitcav/nitr) [![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/bitcav/nitr/blob/master/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**.
> curl + jq demo
Table of contents
=================
* [Installation](#gear-installation)
* [Download](#download)
* [Build](#build)
* [Running](#rocket-running)
* [Commands](#white_square_button-available-commands)
* [Docker](#whale-docker)
* [Web Panel](#earth_americas-web-panel)
* [QR Code](#qr-code)
* [Usage](#pick-usage)
* [Example](#example)
* [Api v1](#api-v1)
* [Available Endpoints](#satellite-available-endpoints)
* [JSON Data References](#mag-json-data-references)
* [Settings](#wrench-settings)
* [Platform Support](#heavy_check_mark-platform-support)
* [Powered by](#zap-powered-by)
## :gear: 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
```## :rocket: 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
## :white_square_button: Available Commands
Help:
```
nitr -h
```Change Password:
```
nitr passwd
```Get api key:
```
nitr key
```Print Qr Code:
```
nitr qr
```## :whale: Docker
Build image using command:
```
docker build -t nitr .
```Run container:
```
docker run -d -p 8000:8000 nitr:latest
```### :earth_americas: Web Panel
Go to [http://localhost:8000](http://localhost:8000) in your web browser![preview](https://raw.githubusercontent.com/bitcav/nitr/master/images/login-web.png)
Access with default **password**: **123456**
![preview](https://raw.githubusercontent.com/bitcav/nitr/master/images/panel-web.png)
## QR Code
The QR Code contains the exact same information displayed in the Host Info Panel formatted as JSON.
## :pick: Usage
Requesting system info with HTTP Get Method through [the API endpoints](#satellite-available-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:```json
{
"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
```### :satellite: Available Endpoints
These endpoints allow you to get System and Hardware information about your **host**. Check the [example](#example) for a better understanding.
| Verb | Endpoint | JSON Data |
|--------|-------------------------------|------------------------------|
|GET | /cpu | [CPU](#cpu) |
|GET | /bios | [Bios](#bios) |
|GET | /bandwidth | [Bandwidth](#bandwidth) |
|GET | /chassis | [Chassis](#chassis) |
|GET | /disks | [Disks](#disks) |
|GET | /drives | [Drives](#drives) |
|GET | /gpu | [GPU](#gpu) |
|GET | /isp | [ISP](#isp) |
|GET | /network | [Network](#network) |
|GET | /processes | [Processes](#processes) |
|GET | /ram | [RAM](#ram) |
|GET | /baseboard | [Baseboard](#baseboard) |
|GET | /product | [Product](#product) |
|GET | /memory | [Memory](#Memory) |## :mag: 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
:lock: 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
:lock: 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
:lock: 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
:lock: 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 |## :wrench: 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
```## :heavy_check_mark: Platform Support
**Windows**
Tested:
- Windows 10
- Windows 7 SP1**Linux**
Tested:
- Ubuntu Linux 20.04 LTS
- Debian Linux 10
- Manjaro Linux 20## :zap: Powered by
* [Fiber](https://gofiber.io/) - The web framework used
* [bbolt](https://github.com/etcd-io/bbolt) - Database
* [UIKit](https://getuikit.com/) - Front-End framework
* [gopsutil](https://github.com/shirou/gopsutil) - psutil for Golang
* [ghw](https://github.com/jaypipes/ghw) - Golang HardWare discovery/inspection library
* [go-smbios](https://github.com/digitalocean/go-smbios) - Detection and access to System Management BIOS