Compare commits
No commits in common. "63956de837f5cf608524df892ebfac69f63a2029" and "35b475e46f5ce3e96846fc650344532e26995f2e" have entirely different histories.
63956de837
...
35b475e46f
@ -117,8 +117,6 @@ func DatapointAdd[T any](name string, value T) (err error) { // {{{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
service.Db.Conn.Exec(`UPDATE datapoint SET last_value = NOW() WHERE name=$1`, name)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
} // }}}
|
} // }}}
|
||||||
|
|
||||||
|
11
main.go
11
main.go
@ -26,13 +26,12 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "v9"
|
const VERSION = "v7"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
flagConfigFile string
|
flagConfigFile string
|
||||||
flagDev bool
|
flagDev bool
|
||||||
flagVersion bool
|
|
||||||
service *ws.Service
|
service *ws.Service
|
||||||
logFile *os.File
|
logFile *os.File
|
||||||
parsedTemplates map[string]*template.Template
|
parsedTemplates map[string]*template.Template
|
||||||
@ -60,7 +59,6 @@ func init() { // {{{
|
|||||||
cfgPath := path.Join(confDir, "smon.yaml")
|
cfgPath := path.Join(confDir, "smon.yaml")
|
||||||
flag.StringVar(&flagConfigFile, "config", cfgPath, "Path and filename of the YAML configuration file")
|
flag.StringVar(&flagConfigFile, "config", cfgPath, "Path and filename of the YAML configuration file")
|
||||||
flag.BoolVar(&flagDev, "dev", false, "reload templates on each request")
|
flag.BoolVar(&flagDev, "dev", false, "reload templates on each request")
|
||||||
flag.BoolVar(&flagVersion, "version", false, "Display version and exit")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
componentFilenames, err = getComponentFilenames(viewFS)
|
componentFilenames, err = getComponentFilenames(viewFS)
|
||||||
@ -72,11 +70,6 @@ func init() { // {{{
|
|||||||
} // }}}
|
} // }}}
|
||||||
|
|
||||||
func main() { // {{{
|
func main() { // {{{
|
||||||
if flagVersion {
|
|
||||||
fmt.Println(VERSION)
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
werr.Init()
|
werr.Init()
|
||||||
@ -268,7 +261,7 @@ func entryDatapoint(w http.ResponseWriter, r *http.Request, sess *session.T) { /
|
|||||||
WHERE
|
WHERE
|
||||||
service=$1 AND
|
service=$1 AND
|
||||||
prio=$2
|
prio=$2
|
||||||
`,
|
`,
|
||||||
(*notificationService).GetType(),
|
(*notificationService).GetType(),
|
||||||
(*notificationService).GetPrio(),
|
(*notificationService).GetPrio(),
|
||||||
problemID,
|
problemID,
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
{{ define "fonts" }}
|
{{ define "fonts" }}
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -5,18 +5,6 @@
|
|||||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||||
{{ template "fonts" }}
|
{{ template "fonts" }}
|
||||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/main.css">
|
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/main.css">
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.2.1/dist/chart.umd.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/luxon@3.3.0/build/global/luxon.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.3.1"></script>
|
|
||||||
|
|
||||||
<script type="importmap">
|
|
||||||
{
|
|
||||||
"imports": {
|
|
||||||
"chart.js": "/js/{{ .VERSION }}/lib/chartjs/index.d.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="layout">
|
<div id="layout">
|
||||||
|
@ -2,19 +2,8 @@
|
|||||||
{{ $version := .VERSION }}
|
{{ $version := .VERSION }}
|
||||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/datapoints.css">
|
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/datapoints.css">
|
||||||
|
|
||||||
<script type="module" defer>
|
|
||||||
import { DataGraph } from "/js/{{ .VERSION }}/datapoint_graph.mjs"
|
|
||||||
const graph = new DataGraph({{ .Data.Datapoint }})
|
|
||||||
graph.setData({{ .Data.Values }})
|
|
||||||
graph.render('chart')
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{{ block "page_label" . }}{{end}}
|
{{ block "page_label" . }}{{end}}
|
||||||
|
|
||||||
<div>
|
|
||||||
<canvas id="chart"></canvas>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="values">
|
<div id="values">
|
||||||
{{ range .Data.Values }}
|
{{ range .Data.Values }}
|
||||||
<div class="value">{{ format_time .Ts }}</div>
|
<div class="value">{{ format_time .Ts }}</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user