SyMon

module
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT

README

SyMon

A simple system monitoring tool to monitor server HW stats.

Go Go Report Card

Collecting metrics and features

  • System info
  • CPU info
  • Memory/SWAP info
  • CPU/Memory usage graphs for past hour
  • Disk usage info
  • Primary network interface bandwidth metrics
  • Network usage info
  • Services Active/Inactive
  • 10 most CPU/Memory using processes
  • Custom timeseries metrics
  • Search metrics by date range
  • Point-in-time metrics loading

Usage

Collector

Install or set up a MySQL/MariaDB database for the collector.

Change the config-example.json file and save it as config.json. Set up the env var SYMON_MYSQL_PSWD with the MySQL/MariaDB user name.

Init Collector by running ./collector --init. It will create a key file.

Copy the key file and place the key file with agents/clients.

Run the collector by executing ./collector

Agents can be removed by running ./collector --remove-agent <server-id>

Agents

Change the config-example.json file and save it as config.json. Server-Id should be unique between servers.

Once the config.json file is configured, run the below command to register the agent with the collector.

./agent -init

Once the agent is registered, run the agent in background.

Clients

This is used as the frontend of the application. Change the config-example.json file and save it as config.json.

Run the client and load localhost:port from a browser. Default localhost:9000.

It is recommended to use the client app internally.

Custom metrics

Custom timeseries data can be added using the agent as below. Current server time will be taken as the time.

./agent -custom -name=test -unit=byte -value=1.0

# example
./agent -custom -name='active-http-requests' -unit='requests' -value=$(netstat | grep -c https)

This can be automated using a cron or a script

API documentation
API Authenticatication
  • Client app
    • Since the API call authentication is handled through the client app, API calls via the client app can be used without any authentication.
End points
  • /system
    • Returns system info
  • /memory
    • Returns memory info/usage as an array
    ["timestamp", "used%", "total", "used", "free"]
  • /swap
    • Returns swap info/usage as an array
    ["timestamp", "used%", "total", "used", "free"]
  • /disks
    • Return disk info/usage
	{
	    "Time": "time", 
	    "Disks": [["file system", "mount point", "type", "size", "free", "used", "used%", "inodes", "inodes free", "inodes used", "inodes used%"]]
	}
  • /network
    • Return disk info/usage
	{
	    "Time": "time", 
	    "Networks": [["ip", "interface", "rx", "tx"]]
	}
  • /processes
    • Returns list of processes using most CPU/RAM (10 each)

    {
        "CPU": [
            ["pid", "cpu", "mem", "command"],
            ["pid", "cpu", "mem", "command"]
        ],
        
        "Memory": [
            ["pid", "cpu", "mem", "command"],
            ["pid", "cpu", "mem", "command"]
        ]
    }
  • /processor-usage-historical
    • CPU load avg
    ["timestamp", "load%"]
  • /memory-historical
    • Memory usage
    ["timestamp", "used%", "total", "used", "free"]
  • /services
    • List of services enabled to monitor in agent's config.json
    [{"Name":"name","Running":true,"Time":"1632680550"},]
  • /custom-metric-names
    • Names of custom metrics
    {"CustomMetrics": ["active-http-requests",]}
  • /custom?custom-metric=name
    • Custom metric values
    [{"Name":"active-http-requests","ServerId":"id","Time":"time","Unit":"unit","Value":"x"},]
  • Required GET parameters
    • serverId= ID of the server
  • Optional GET parameters
    • from=[unix timestamp]&to=[unix timestamp] values within a time range
    • time=[unix timestamp] value(s) at a certain time (depends on availability of data)

Todo

  • Disk I/O graphs
  • Alerts
  • Dark mode
  • Automatic data deletion past retention period

Jump to

Keyboard shortcuts

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