Skip to content

Commit 08d2792

Browse files
committed
Initial Commit : Base Repo changes
1 parent 9b41d2c commit 08d2792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2719
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
.vault_pass

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Nutanix Audit/Information Dashboard
2+
3+
## Overview
4+
5+
Nutanix Audit/Information Dashboard is an Ansible-based project aimed at providing a comprehensive dashboard for auditing and monitoring Nutanix clusters. The project is currently being migrated to Golang for improved concurrency and logging capabilities. Prometheus exporter will be integrated for further monitoring.
6+
7+
## Disclaimer
8+
9+
**Please Read Carefully:** This project utilizes internal APIs that are not publicly supported by [Nutanix](https://www.nutanix.dev/). Use caution when deploying this project and ensure that you have thoroughly reviewed all APIs before running it in a production environment. Nutanix will not be responsible for any issues arising from the use of this project and will not provide support for its implementation.
10+
11+
## Compatibility
12+
13+
Tested on:
14+
- Nutanix AOS 6.x till 6.5.5.1
15+
- PC: 2022.9 - 2023.4
16+
17+
**Note:** Some fields may contain negative value, which could be due to licensing violations or API issues.
18+
19+
## Getting Started
20+
21+
To get started with this project, follow these steps:
22+
23+
1. Ensure Ansible is installed on your system.
24+
2. Make the necessary configuration changes in `vars/main.yml` to include your Nutanix PC information.
25+
3. Create or update the `.vault_pass` file with the appropriate credentials:
26+
27+
```bash
28+
echo "nutanix/4u" > .vault_pass
29+
```
30+
31+
4. Update the vault_user and pc_password in `vault.yml` and rekey the vault if required:
32+
33+
```bash
34+
ansible-vault edit group_vars/all/vault.yml
35+
```
36+
37+
5. Execute the playbook:
38+
39+
```bash
40+
ansible-playbook main.yml --vault-password-file=.vault_pass
41+
```
42+
43+
## Customization
44+
45+
Jinja templates are available under `roles/nutanix_generate_report` role, allowing you to customize the generated reports. Sample reports can be found under the `output` folder. You can add additional fields as needed.
46+
47+
Cron Job can be set to schedule running this playbook.
48+
49+
```bash
50+
*/10 * * * * cd /path/to/folder/nutanix_audits && ~/.local/bin/ansible-playbook main.yml > logfile.log 2>&1
51+
```
52+
53+
54+
## Data Generated
55+
56+
The following data is currently generated for the Nutanix cluster can be found under `output/json_output.html`:
57+
58+
59+
## Support
60+
61+
If you encounter any issues or need assistance, please raise an issue.
62+

ansible.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[defaults]
2+
vault_password_file = .vault_pass
3+
inventory = ./inventory

group_vars/all/vault.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$ANSIBLE_VAULT;1.1;AES256
2+
61653030363330346262303738613762323564366532663762363839666539373931623633303339
3+
3831376362653166356130343734353361383835303436320a336336313265353430356237366235
4+
33613436613138353965616437333235383365383763306662633863316164363932626461306238
5+
3465386535643635330a616536623435663863376538613432336536623939356134343839393064
6+
66336463333034303566323363326564616566663133396637653162346635613662626437333436
7+
64376434613864613463383466656437626339306261386434346237646564326334653739626532
8+
643535353063396565663731636338376230

host_vars/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# Host variables go here

inventory

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[local]
2+
localhost ansible_connection=local
3+
4+
5+
[web_server]

main.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
- name: Try out roles
3+
hosts: localhost
4+
gather_facts: true
5+
vars_files:
6+
- vars/main.yml
7+
tasks:
8+
9+
- name: Setup All require variables for playbooks
10+
ansible.builtin.include_role:
11+
name: nutanix_setup
12+
13+
- name: Perform Basic Checks
14+
ansible.builtin.include_role:
15+
name: nutanix_health_check
16+
17+
- name: Generate Report
18+
ansible.builtin.include_role:
19+
name: nutanix_generate_report
20+
vars:
21+
end_time: "{{ ansible_date_time.iso8601 }}"
22+
23+
24+
# If Web Server is running on different host then add them to inventory and edit below as the requirement.
25+
- name: Copy output files to Web Server
26+
hosts: localhost
27+
become: true
28+
gather_facts: true
29+
tasks:
30+
- name: Custome index.html
31+
ansible.builtin.copy:
32+
dest: /var/www/html/index.html
33+
src: output/index.html
34+
mode: '0644'
35+
36+
- name: Copy basic check
37+
ansible.builtin.copy:
38+
dest: /var/www/html/basic_checks.html
39+
src: output/basic_checks.html
40+
mode: '0644'
41+
42+
- name: Copy health check
43+
ansible.builtin.copy:
44+
dest: /var/www/html/health_checks.html
45+
src: output/health_checks.html
46+
mode: '0644'
47+
48+
- name: Copy json data
49+
ansible.builtin.copy:
50+
dest: /var/www/html/json_template.json
51+
src: output/json_template.json
52+
mode: '0644'

output/README.md

Whitespace-only changes.

output/basic_checks.html

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Cluster Basic Summary Report</title>
6+
<style>
7+
body {
8+
background-color: #3498DB;
9+
}
10+
11+
table {
12+
width: 100%;
13+
border-collapse: collapse;
14+
background-color: #fff;
15+
box-shadow: 0 6px 10px -4px rgba(0, 0, 0, 0.15);
16+
border-radius: 10px;
17+
overflow: hidden;
18+
margin-bottom: 20px;
19+
font-family: Arial, sans-serif;
20+
font-size: 14px;
21+
line-height: 1.4;
22+
color: #333333;
23+
}
24+
25+
th,
26+
td {
27+
padding: 12px 15px;
28+
text-align: center;
29+
border-bottom: 1px solid #ddd;
30+
}
31+
32+
th {
33+
background-color: #f2f2f2;
34+
}
35+
36+
tr:hover {
37+
background-color: #f5f5f5;
38+
}
39+
40+
.no-wrap {
41+
white-space: nowrap;
42+
}
43+
44+
45+
</style>
46+
47+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">
48+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
49+
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
50+
51+
<script>
52+
$(document).ready(function() {
53+
$('#clusterTable').DataTable({
54+
"paging": true,
55+
"ordering": true,
56+
"info": true,
57+
"searching": true
58+
});
59+
60+
// Add a single search bar at the top of the table
61+
$('#clusterTable_filter').addClass('mb-3');
62+
$('#clusterTable_filter label').contents().filter(function() {
63+
return this.nodeType === 3; // Node.TEXT_NODE
64+
}).remove();
65+
$('#clusterTable_filter label').prepend('<span class="visually-hidden">Search:</span>');
66+
$('#clusterTable_filter input').addClass('form-control');
67+
});
68+
</script>
69+
70+
71+
</head>
72+
73+
<body>
74+
<div class="container-fluid">
75+
<h2>Cluster Basic Checks</h2>
76+
<table id="clusterTable" class="table table-striped table-bordered">
77+
<thead>
78+
<tr>
79+
<th>Cluster Name</th>
80+
<th>Number of Nodes</th>
81+
<th> AOS Version </th>
82+
<th> Hypervisor Types </th>
83+
<th> Hypervisor Version</th>
84+
<th> Number of VMs</th>
85+
<th>Cluster Capacity Runway (days)</th>
86+
<th>Cluter Inefficient VMs</th>
87+
</tr>
88+
</thead>
89+
<tbody>
90+
<tr>
91+
<td class="no-wrap"><a href="https://10.38.84.37:9440" target="_blank">PHX-POC312</a></td>
92+
<td>4</td>
93+
<td>6.5.1.6</td>
94+
<td>['kKvm']</td>
95+
<td>['Nutanix 20201105.30417']</td>
96+
97+
<td>27</td>
98+
99+
<td>nan</td>
100+
101+
<td>7</td>
102+
103+
</tr>
104+
</tbody>
105+
</table>
106+
</div>
107+
Report generated at 2024-02-26 19:04:58 UTC <a href="index.html"> Back To Main Page </a>
108+
109+
</body>
110+
</html>

output/health_checks.html

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Cluster Health Summary Report</title>
6+
<style>
7+
8+
body {
9+
background-color: #3498DB;
10+
}
11+
12+
table {
13+
width: 100%;
14+
border-collapse: collapse;
15+
background-color: #fff;
16+
box-shadow: 0 6px 10px -4px rgba(0, 0, 0, 0.15);
17+
border-radius: 10px;
18+
overflow: hidden;
19+
margin-bottom: 20px;
20+
font-family: Arial, sans-serif;
21+
font-size: 14px;
22+
line-height: 1.4;
23+
color: #333333;
24+
}
25+
26+
th,
27+
td {
28+
padding: 12px 15px;
29+
text-align: center;
30+
border-bottom: 1px solid #ddd;
31+
}
32+
33+
th {
34+
background-color: #f2f2f2;
35+
}
36+
37+
tr:hover {
38+
background-color: #f5f5f5;
39+
}
40+
41+
.no-wrap {
42+
white-space: nowrap;
43+
}
44+
45+
</style>
46+
47+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">
48+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
49+
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
50+
51+
<script>
52+
$(document).ready(function() {
53+
$('#clusterTable').DataTable({
54+
"paging": true,
55+
"ordering": true,
56+
"info": true,
57+
"searching": true
58+
});
59+
60+
// Add a single search bar at the top of the table
61+
$('#clusterTable_filter').addClass('mb-3');
62+
$('#clusterTable_filter label').contents().filter(function() {
63+
return this.nodeType === 3; // Node.TEXT_NODE
64+
}).remove();
65+
$('#clusterTable_filter label').prepend('<span class="visually-hidden">Search:</span>');
66+
$('#clusterTable_filter input').addClass('form-control');
67+
});
68+
</script>
69+
70+
71+
</head>
72+
73+
<body>
74+
<div class="container-fluid">
75+
<h2>Cluster Health & Resiliency Checks</h2>
76+
<table id="clusterTable" class="table table-striped table-bordered">
77+
<thead>
78+
<tr>
79+
<th>Cluster Name</th>
80+
<th>Cluster Redundancy State</th>
81+
<th>Cluster Data Resiliency Status</th>
82+
<th>Cluster Storage Usage(%)</th>
83+
<th>Cluster CPU Usage(%)</th>
84+
<th>Cluster Memory Usage(%)</th>
85+
<th>Has Critical Cluster Services</th>
86+
<th>Has Critical Hosts</th>
87+
</tr>
88+
</thead>
89+
<tbody>
90+
<tr>
91+
<td class="no-wrap"><a href="https://10.38.84.37:9440" target="_blank">PHX-POC312</a></td>
92+
<td style="background-color:">GOOD</td>
93+
<td style="background-color:">OK</td>
94+
<td style="background-color:">-1</td>
95+
<td style="background-color:">12.68</td>
96+
<td style="background-color:">73.07</td>
97+
<td style="background-color:">False</td>
98+
99+
100+
<td style="background-color:">False</td>
101+
</tr>
102+
</tbody>
103+
</table>
104+
</div>
105+
Report generated at 2024-02-26 19:04:58 UTC <a href="index.html"> Back To Main Page </a>
106+
</body>
107+
</html>

0 commit comments

Comments
 (0)