-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.go
More file actions
49 lines (32 loc) · 826 Bytes
/
agent.go
File metadata and controls
49 lines (32 loc) · 826 Bytes
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
package main
import (
"bytes"
"dockerstack/dockerstack-agent/config"
"encoding/json"
"fmt"
"io/ioutil"
_ "dockerstack/dockerstack-agent/logging"
"net/http"
"dockerstack/dockerstack-agent/server"
)
func main() {
k, _ := server.ServerMemory()
p, _ := server.ProcessList()
fmt.Println(p)
test := config.Main("interface")
fmt.Println(test)
mar, _ := json.Marshal(k)
buf := bytes.NewBuffer(mar)
enc := json.NewEncoder(buf)
err := enc.Encode(mar)
if err != nil {
panic(err)
}
// response, _ := http.Get("http://www.google.com")
send, _ := http.Post("https://demo7965648.mockable.io/serverdata", "application/json", buf)
body, _ := ioutil.ReadAll(send.Body)
raw := bytes.NewBuffer(body)
s := raw.String()
fmt.Println(s)
fmt.Println(enc)
}