diff options
author | luixal <luixal@gmail.com> | 2022-10-11 19:00:53 +0200 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-10-13 21:51:06 +0200 |
commit | 13069da195950d2598492ea9f4a8bb4585fcb71f (patch) | |
tree | 0f34b16c486bf43f7758139571f91781a0d81d21 | |
parent | 0a03fcd9cd508514a6e2d5e3a6bb62bae6252331 (diff) | |
download | homer-13069da195950d2598492ea9f4a8bb4585fcb71f.tar.gz homer-13069da195950d2598492ea9f4a8bb4585fcb71f.tar.zst homer-13069da195950d2598492ea9f4a8bb4585fcb71f.zip |
Adds loading and errors icons/msgs. Adds docs.
-rw-r--r-- | docs/customservices.md | 11 | ||||
-rw-r--r-- | src/components/services/Proxmox.vue | 16 |
2 files changed, 24 insertions, 3 deletions
diff --git a/docs/customservices.md b/docs/customservices.md index 67baed0..417459e 100644 --- a/docs/customservices.md +++ b/docs/customservices.md | |||
@@ -250,6 +250,17 @@ The Healthchecks API key can be found in Settings > API Access > API key (read-o | |||
250 | 250 | ||
251 | This service displays status information of a Proxmox node (VMs running and disk, memory and cpu used). It uses the proxmox API and [API Tokens](https://pve.proxmox.com/pve-docs/pveum-plain.html) for authorization so you need to generate one to set in the yaml config. You can set it up in Proxmox under Permissions > API Tokens. You also need to know the realm the user of the API Token is assigned to (by default pam). | 251 | This service displays status information of a Proxmox node (VMs running and disk, memory and cpu used). It uses the proxmox API and [API Tokens](https://pve.proxmox.com/pve-docs/pveum-plain.html) for authorization so you need to generate one to set in the yaml config. You can set it up in Proxmox under Permissions > API Tokens. You also need to know the realm the user of the API Token is assigned to (by default pam). |
252 | 252 | ||
253 | The API Token (or the user asigned to that token if not separated permissions is checked) are this: | ||
254 | |||
255 | | Path | Permission | Comments | | ||
256 | | ------------------ | ---------- | | | ||
257 | | /nodes/<your-node> | Sys.Audit | | | ||
258 | | /vms/<id-vm> | VM.Audit | You need to have this permission on any VM you want to be counted | | ||
259 | |||
260 | It is highly recommended that you create and API Token with only these permissions on a read-only mode. | ||
261 | |||
262 | If you get errors, they will be shown on browser's dev console. Main issues tend to be CORS related as Proxmox does not include CORS headers and you have to desploy it behind a reverse proxy and make the proxy add this headers. | ||
263 | |||
253 | Configuration example: | 264 | Configuration example: |
254 | 265 | ||
255 | ```yaml | 266 | ```yaml |
diff --git a/src/components/services/Proxmox.vue b/src/components/services/Proxmox.vue index 981bdf1..092d077 100644 --- a/src/components/services/Proxmox.vue +++ b/src/components/services/Proxmox.vue | |||
@@ -7,8 +7,11 @@ | |||
7 | {{ item.subtitle }} | 7 | {{ item.subtitle }} |
8 | </template> | 8 | </template> |
9 | <template v-else-if="vms"> | 9 | <template v-else-if="vms"> |
10 | <div v-if="error"> | 10 | <div v-if="loading"> |
11 | <strong class="danger">Error loading info!</strong> | 11 | <strong>Loading...</strong> |
12 | </div> | ||
13 | <div v-else-if="error"> | ||
14 | <strong class="danger">Error loading info</strong> | ||
12 | </div> | 15 | </div> |
13 | <div v-else class="metrics"> | 16 | <div v-else class="metrics"> |
14 | <span>VMs: <span class="is-number"><strong>{{ vms.running }}</strong>/{{vms.total}}</span></span> | 17 | <span>VMs: <span class="is-number"><strong>{{ vms.running }}</strong>/{{vms.total}}</span></span> |
@@ -19,6 +22,10 @@ | |||
19 | </template> | 22 | </template> |
20 | </p> | 23 | </p> |
21 | </template> | 24 | </template> |
25 | <template #indicator> | ||
26 | <i v-if="loading" class="fa fa-circle-notch fa-spin fa-2xl"></i> | ||
27 | <i v-if="error" class="fa fa-exclamation-circle fa-2xl danger"></i> | ||
28 | </template> | ||
22 | </Generic> | 29 | </Generic> |
23 | </template> | 30 | </template> |
24 | 31 | ||
@@ -43,7 +50,8 @@ | |||
43 | memoryUsed: 0, | 50 | memoryUsed: 0, |
44 | diskUsed: 0, | 51 | diskUsed: 0, |
45 | cpuUsed: 0, | 52 | cpuUsed: 0, |
46 | error: false | 53 | error: false, |
54 | loading: true | ||
47 | }), | 55 | }), |
48 | created() { | 56 | created() { |
49 | this.fetchStatus(); | 57 | this.fetchStatus(); |
@@ -71,8 +79,10 @@ | |||
71 | this.vms.total += vms.data.length; | 79 | this.vms.total += vms.data.length; |
72 | this.vms.running += vms.data.filter( i => i.status === 'running' ).length; | 80 | this.vms.running += vms.data.filter( i => i.status === 'running' ).length; |
73 | this.error = false; | 81 | this.error = false; |
82 | this.loading = false; | ||
74 | } catch(err) { | 83 | } catch(err) { |
75 | console.log(err); | 84 | console.log(err); |
85 | this.loading = false; | ||
76 | this.error = true; | 86 | this.error = true; |
77 | } | 87 | } |
78 | }, | 88 | }, |