Skip to content

Commit

Permalink
fix pr comments and add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
doniacld committed Jul 19, 2022
1 parent b7ed70e commit 4a67698
Show file tree
Hide file tree
Showing 8 changed files with 649 additions and 44 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You should expect a 200 HTTP answer:
< Connection: keep-alive
```

If you have an Arduino board, you can flash [this program]() on your card using this command. Adjust the target to your model.
If you have an Arduino board, you can flash [this program](https://github.com/doniacld/tinygo-discovery/blob/main/tiny-hen/main.go) on your card using this command. Adjust the target to your model.

```bash
tinygo flash -target=arduino-nano33 wifinina/httppost/main.go
Expand Down
6 changes: 4 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import (
"github.com/doniacld/tiny-hen/cmd/prommetric"
)

const serverPort = ":10010"

func main() {
// register the prometheus metrics
prommetric.RegisterGauges()

fmt.Println("Listening on port 10010")
fmt.Printf("Listening on port%s\n", serverPort)
mux := http.NewServeMux()

// GET /hi
Expand All @@ -26,7 +28,7 @@ func main() {
// GET /metrics
mux.Handle("/metrics", promhttp.Handler())

err := http.ListenAndServe(":10010", mux)
err := http.ListenAndServe(serverPort, mux)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/prommetric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func (m PromMeasure) SetTempAndHum() {
TempGauge.Set(m.Temperature)
HumGauge.Set(m.Humidity)

fmt.Printf("%s: SetTempAndHum set values: Temperature: %d °C, Humidity: %d %%\n",
fmt.Printf("%s: SetTempAndHum set values: Temperature: %f °C, Humidity: %f %%\n",
time.Now(), m.Temperature, m.Humidity)
}
4 changes: 3 additions & 1 deletion deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ echo "
___ _ _ _
|_ _|<_>._ _ _ _ | | | ___ ._ _
| | | || ' || | | | - |/ ._>| ' |
|_| |_||_|_|\_. | |_|_|\___.|_|_|
🐓 |_| |_||_|_|\_. | |_|_|\___.|_|_|v 🐓
<___| "

echo "---------------- 🏠 Create cluster tinyhen ----------------"
Expand All @@ -17,6 +17,8 @@ kubectl apply -k deploy/monitoring

# Install prometheus stack (Grafana, Prometheus operator, etc)
echo "---------------- 🔎 Deploying kube prometheus stack with dashboard provider ----------------"
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack --values deploy/monitoring/values.yaml --namespace monitoring

# Deploy the prometheus service monitoring for the app
Expand Down
Loading

0 comments on commit 4a67698

Please sign in to comment.