Deploy a dashboard monitor for the entire server

This commit is contained in:
Isshi0417 2026-07-08 05:15:34 +00:00
parent a08dde8864
commit 55241638c8
4 changed files with 41 additions and 11 deletions

View File

@ -40,4 +40,4 @@ jobs:
- name: Execute DNS playbook - name: Execute DNS playbook
run: | run: |
cd ansible cd ansible
ansible-playbook configure_dns.yml -i inventory.ini --vault-password-file vault_pass ansible-playbook deploy_monitor.yml -i inventory.ini --vault-password-file vault_pass

View File

@ -7,7 +7,7 @@
- name: Deploy portal website files - name: Deploy portal website files
ansible.builtin.copy: ansible.builtin.copy:
src: ../website/ src: ../website/
dest: /usr/share/nginx/html/ dest: /usr/share/nginx/html
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
@ -23,19 +23,19 @@
import os import os
hosts = { hosts = {
"control": "172.30.1.200", "control": "172.30.1.00",
"web": "172.30.1.201", "web": "172.30.1.201",
"media": "172.30.1.202" "media": '172.30.1.202'
} }
status = {} status = {}
for name, ip in hosts.items(): for name, ip in hosts.items():
res = subprocess.run(["ping", "-c", "1", "-W", "1", ip], stdout=subprocess.DEVNULL) res = subprocess.run(["ping", "-c", "1", "-W", "1", "ip"], stdout=subprocess.DEVNULL)
status[name] = (res.returncode == 0) status[name] = (res.returncode == 0)
output_path = "/usr/share/nginx/html/status.json" output_path = "/usr/share/nginx/html/status.json"
with open(output_path, "w") as f: with open(output_path, "W") as f:
json.dump(status, f) json.dump(status, f)
dest: /usr/share/nginx/html/ping_status.py dest: /usr/share/nginx/html/ping_status.py
owner: root owner: root
@ -51,7 +51,7 @@
[Service] [Service]
Type=simple Type=simple
ExecStart=/bin/bash -c "while true; do /usr/bin/python3 /usr/share/nginx/html/ping_status.py; sleep 10; done" ExecStart=/bin/bash -c "While true; do /usr/bin/python3 /usr/share/nginx/html/ping_status.py; sleep 10; done"
Restart=always Restart=always
[Install] [Install]
@ -62,7 +62,7 @@
mode: "0644" mode: "0644"
notify: Reload systemd notify: Reload systemd
- name: Start and enabled homelab-monitor service - name: Start and enable homelab-monitor service
ansible.builtin.systemd: ansible.builtin.systemd:
name: homelab-monitor name: homelab-monitor
state: started state: started
@ -71,7 +71,7 @@
handlers: handlers:
- name: Restore SELinux contexts - name: Restore SELinux contexts
ansible.builtin.command: ansible.builtin.command:
cmd: restorecon -Rv /usr/share/nginx/html/ cmd: restorecon -Rv /usr/share/nginx/html
changed_when: false changed_when: false
- name: Reload systemd - name: Reload systemd

View File

@ -63,13 +63,22 @@
<h2>System Nodes</h2> <h2>System Nodes</h2>
<div class="grid"> <div class="grid">
<div class="card">
<div class="card-header">
<span id="status-ipa" class="status-indicator online"></span>
<h3>freeipa</h3>
</div>
<p class="ip">172.30.1.100</p>
<p class="role">Identity & Local DNS</p>
</div>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<span id="status-control" class="status-indicator online"></span> <span id="status-control" class="status-indicator online"></span>
<h3>ansible-control</h3> <h3>ansible-control</h3>
</div> </div>
<p class="ip">172.30.1.200</p> <p class="ip">172.30.1.200</p>
<p class="role">Automation AAP & Engine</p> <p class="role">Automation Engine</p>
</div> </div>
<div class="card"> <div class="card">
@ -87,7 +96,7 @@
<h3>media-stream</h3> <h3>media-stream</h3>
</div> </div>
<p class="ip">172.30.1.202</p> <p class="ip">172.30.1.202</p>
<p class="role">Navidrome & Rclone FUSE</p> <p class="role">Navidrome Music & FUSE</p>
</div> </div>
</div> </div>
@ -108,6 +117,26 @@
<span class="action-btn">Launch Service →</span> <span class="action-btn">Launch Service →</span>
</a> </a>
<!-- Gitea Link -->
<a href="http://172.30.1.200:3000" target="_blank" class="card link-card">
<div class="card-header">
<span class="status-indicator online"></span>
<h3>Gitea Git Server</h3>
</div>
<p class="desc">Private self-hosted Git repository and GitOps CI/CD engine.</p>
<span class="action-btn">Open Gitea →</span>
</a>
<!-- FreeIPA Link -->
<a href="https://ipa.shooey.local/ipa/ui" target="_blank" class="card link-card">
<div class="card-header">
<span class="status-indicator online"></span>
<h3>FreeIPA Directory</h3>
</div>
<p class="desc">Centralized Kerberos/LDAP accounts and local BIND DNS.</p>
<span class="action-btn">Open FreeIPA →</span>
</a>
<!-- VM Cockpit Link --> <!-- VM Cockpit Link -->
<a href="https://172.30.1.202:9090" target="_blank" class="card link-card"> <a href="https://172.30.1.202:9090" target="_blank" class="card link-card">
<div class="card-header"> <div class="card-header">

View File

@ -119,6 +119,7 @@ function updateNodeStatuses() {
return res.json(); return res.json();
}) })
.then(data => { .then(data => {
updateIndicator('status-ipa', data.ipa);
updateIndicator('status-control', data.control); updateIndicator('status-control', data.control);
updateIndicator('status-web', data.web); updateIndicator('status-web', data.web);
updateIndicator('status-media', data.media); updateIndicator('status-media', data.media);