Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -2784,14 +2784,15 @@ Linkding is a self-hosted bookmarking service, which has a clean interface and i

[Tactical RMM](https://github.com/amidaware/tacticalrmm) is a self-hosted remote monitoring & management tool.

<p align="center"><a href="https://ibb.co/NVHWpD1"><img src="https://pixelflare.cc/alicia/dashy/tactical-rmm" alt="Capture" border="0"></a></p>
<p align="center"><a href="https://github.com/user-attachments/assets/152a7205-e5de-401f-bad8-19063ddfaf3c">
<img src="https://github.com/user-attachments/assets/5921d46f-d84c-494d-8aaf-6b20cc592640" alt="Capture" border="0"></a></p>


#### Options

| **Field** | **Type** | **Required** | **Description** |
| ------------ | -------- | ------------ | ------------------------------------------------------------------------ |
| **`url`** | `string` | Required | The status endpoint URL (https://api.example.com/core/status/) |
| **`url`** | `string` | Required | The status endpoint URL (https://api.example.com/core/v2/status/) |
| **`token`** | `string` | Required | The MON_TOKEN (see https://docs.tacticalrmm.com/tipsntricks/#monitor-your-trmm-instance-via-the-built-in-monitoring-endpoint). |

#### Example
Expand All @@ -2801,7 +2802,7 @@ Linkding is a self-hosted bookmarking service, which has a clean interface and i
useProxy: true
options:
token: PkPVKMzbmXgeQDlJWb0WXYvsIk3JvZyadURud2cSTdMia6hUbQ
url: https://api.example.com/core/status/
url: https://api.example.com/core/v2/status/
```

#### Info
Expand Down
59 changes: 24 additions & 35 deletions src/components/Widgets/TacticalRMM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@
<div class="title">Cert Expired</div>
<div class="value">{{ statusData.cert_expired ? 'Yes' : 'No' }}</div>
</div>
<div class="status-item">
<div class="title">Celery Queue Length</div>
<div class="value">{{ statusData.celery_queue_len }}</div>
</div>
<div class="status-item">
<div class="title">Celery Queue Health</div>
<div class="value">{{ statusData.celery_queue_health }}</div>
</div>
<div class="status-item">
<div class="title">NATS STD Ping</div>
<div class="value">{{ statusData.nats_std_ping ? 'Healthy' : 'Unhealthy' }}</div>
</div>
<div class="status-item">
<div class="title">NATS WS Ping</div>
<div class="value">{{ statusData.nats_ws_ping ? 'Healthy' : 'Unhealthy' }}</div>
</div>
<div class="status-item">
<div class="title">Mesh Ping</div>
<div class="value">{{ statusData.mesh_ping ? 'Healthy' : 'Unhealthy' }}</div>
</div>
<div class="status-item services">
<div class="title">Services Running</div>
<div class="services-list">
Expand Down Expand Up @@ -61,18 +81,10 @@
</template>

<script>
import request from '@/utils/request';
import WidgetMixin from '@/mixins/WidgetMixin';
import { serviceEndpoints } from '@/utils/defaults';

export default {
mixins: [WidgetMixin],
props: {
options: {
type: Object,
default: () => ({}),
},
},
data() {
return {
statusData: null,
Expand All @@ -95,50 +107,27 @@ export default {
},
authHeaders() {
return {
'X-MON-TOKEN': this.token,
'Content-Type': 'application/json',
};
},
proxyReqEndpoint() {
const baseUrl = process.env.VUE_APP_DOMAIN || window.location.origin;
return `${baseUrl}${serviceEndpoints.corsProxy}`;
},
},
methods: {
update() {
this.startLoading();
this.fetchData();
},
fetchData() {
const {
authHeaders, url, token, proxyReqEndpoint,
} = this;

const { authHeaders, url, token } = this;
if (!this.optionsValid({ url, token })) {
return;
}

const targetURL = url;
const customHeaders = JSON.stringify(authHeaders);

request.post(
proxyReqEndpoint,
{ auth: token },
{
headers: {
'Target-URL': targetURL,
CustomHeaders: customHeaders,
'Content-Type': 'application/json',
},
},
)
this.makeRequest(url, authHeaders)
.then((response) => {
this.processData(response.data);
this.processData(response);
})
.catch(() => {
this.errorMessage = 'Failed to fetch data';
})
.finally(() => {
this.finishLoading();
});
},
processData(response) {
Expand Down
Loading