aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 36bc905ff16f9c394feb653b08012cff1f3b515d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# quickstat
xinetd service to retrieve basic system information

### Build Requirements
* xinetd
* make
* m4

### Run requirements
* xinetd
* iostat

### Installation
1. Run ```make setup``` and provide the port number to run service as
2. Run ```sudo make install```

### Usage
Query the machine running quickstat (via xinetd) using the following URL:  
```http://HOST:PORT/stats```  
  
The resulting JSON will look like this:   
```
{
	"cpu": {
		"pctuser": "4.93",
		"pctsystem": "3.22",
		"pctwait": "0.66",
		"pctidle": "91.15",
		"1minavg": "0.23",
		"5minavg": "0.33",
		"15minavg": "0.36"
	},
	"mem": {
		"total": "439364",
		"used": "80512",
		"free": "11920"
	},
	"swap": {
		"total": "0",
		"used": "0",
		"free": "0"
	},
	"disk": [{
		"device": "sda",
		"read-kbps": "0.29",
		"write-kbps": "23.97"
	}],
	"partition": [{
		"device": "/dev/sda1",
		"mount": "/",
		"total": "27990468",
		"used": "10520320",
		"free": "17470148"
	}, {
		"device": "/dev/sda2",
		"mount": "/boot",
		"total": "102182",
		"used": "24270",
		"free": "77912"
	}]
}
```  
  
Here are the individual resources and the URI they can be queries with:  

| Resource | URI |
| --- | --- |
| All Resources | /stats |
| CPU | /stats/cpu |
| Memory | /stats/mem |
| Swap Space | /status/swap |
| Disk Devices | /status/disk |
| Partitions | /status/partition |
  
## Extending Functionality  
1. Create a script file in `stats` folder (for example, name it `hits`).  This script will be executed when the URL is hit (for example /stats/hits).  
2. Create a file in the `stats` folder with the `.comments` extension that contains information on what the script does (for example `hits.comments`).