mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-11 19:52:51 +01:00
md in description
This commit is contained in:
1
salt/hypervisor/hosts/README
Normal file
1
salt/hypervisor/hosts/README
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This directory will contain hypervisor hosts. We need this README in place to ensure /opt/so/saltstack/local/salt/hypervisor/hosts directory gets created during setup.
|
||||||
@@ -16,25 +16,27 @@
|
|||||||
|
|
||||||
{%- set TEMPLATE = ANNOTATION.hypervisor.hosts.pop('defaultHost') -%}
|
{%- set TEMPLATE = ANNOTATION.hypervisor.hosts.pop('defaultHost') -%}
|
||||||
|
|
||||||
{%- macro update_description(description, cpu_free, mem_free, disk_free, copper_free, sfp_free, vm_list) -%}
|
{%- macro update_description(description, cpu_free, mem_free, disk_free, copper_free, sfp_free, vm_list, cpu_total, mem_total, disk_total, copper_total, sfp_total) -%}
|
||||||
{{- description }}
|
# Hypervisor Configuration: {{ description }}
|
||||||
|
|
||||||
Resource Summary:
|
## Resource Summary
|
||||||
- CPU: {{ cpu_free }} cores available
|
| Resource | Available | Total |
|
||||||
- Memory: {{ mem_free }}GB available
|
|-------------|-----------|-----------|
|
||||||
- Disk Slots: {{ disk_free if disk_free else 'None' }} available
|
| CPU Cores | {{ cpu_free }} | {{ cpu_total }} |
|
||||||
- Copper Ports: {{ copper_free if copper_free else 'None' }} available
|
| Memory (GB) | {{ mem_free }} | {{ mem_total }} |
|
||||||
- SFP Ports: {{ sfp_free if sfp_free else 'None' }} available
|
| Disk | {{ disk_free if disk_free else 'None' }} | {{ disk_total }} |
|
||||||
|
| Copper | {{ copper_free if copper_free else 'None' }} | {{ copper_total }} |
|
||||||
|
| SFP | {{ sfp_free if sfp_free else 'None' }} | {{ sfp_total }} |
|
||||||
|
|
||||||
{%- if vm_list %}
|
{%- if vm_list %}
|
||||||
Virtual Machines:
|
## Virtual Machines
|
||||||
|
| Name | Status | CPU | RAM(GB)| Disk | Copper | SFP | Last Updated |
|
||||||
|
|--------------------|--------------------|-----|--------|------|--------|------|---------------------|
|
||||||
{%- for hostname, vm_data in vm_list.items() %}
|
{%- for hostname, vm_data in vm_list.items() %}
|
||||||
- {{ hostname }}:
|
| {{ hostname }}_{{ vm_data.get('config', {}).get('role', 'unknown') }} | {{ vm_data.get('status', {}).get('status', 'Unknown') }} | {{ vm_data.get('config', {}).get('cpu', 'N/A') }} | {{ vm_data.get('config', {}).get('memory', 'N/A') }} | {{ vm_data.get('config', {}).get('disk', '-') if vm_data.get('config', {}).get('disk') else '-' }} | {{ vm_data.get('config', {}).get('copper', '-') if vm_data.get('config', {}).get('copper') else '-' }} | {{ vm_data.get('config', {}).get('sfp', '-') if vm_data.get('config', {}).get('sfp') else '-' }} | {{ vm_data.get('status', {}).get('timestamp', 'Never') | replace('T', ' ') | regex_replace('\\.[0-9]+', '') }} |
|
||||||
Status: {{ vm_data.get('status', {}).get('status', 'Unknown') }}
|
|
||||||
Details: {{ vm_data.get('status', {}).get('details', 'No details available') }}
|
|
||||||
Last Updated: {{ vm_data.get('status', {}).get('timestamp', 'Never') }}
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
## Virtual Machines
|
||||||
No Virtual Machines Found
|
No Virtual Machines Found
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
@@ -118,13 +120,18 @@ No Virtual Machines Found
|
|||||||
{%- do updated_template.update({
|
{%- do updated_template.update({
|
||||||
'title': hypervisor,
|
'title': hypervisor,
|
||||||
'description': update_description(
|
'description': update_description(
|
||||||
TEMPLATE.description,
|
hypervisor,
|
||||||
cpu_free,
|
cpu_free,
|
||||||
mem_free,
|
mem_free,
|
||||||
disk_free,
|
disk_free,
|
||||||
copper_free,
|
copper_free,
|
||||||
sfp_free,
|
sfp_free,
|
||||||
vms
|
vms,
|
||||||
|
cpu_total,
|
||||||
|
mem_total,
|
||||||
|
disk_total,
|
||||||
|
copper_total,
|
||||||
|
sfp_total
|
||||||
)
|
)
|
||||||
}) -%}
|
}) -%}
|
||||||
{%- do ANNOTATION.hypervisor.hosts.update({hypervisor ~ 'VMs': updated_template}) -%}
|
{%- do ANNOTATION.hypervisor.hosts.update({hypervisor ~ 'VMs': updated_template}) -%}
|
||||||
|
|||||||
Reference in New Issue
Block a user