')
+
#########
# IMAGE #
#########
elif json_result[0] == 'image':
+ print("Processing images ...")
try:
for image in json_result[1]['entities']:
entity_name = image["status"]["name"]
@@ -384,6 +397,7 @@ def generate_template(json_results):
# HOST #
########
elif json_result[0] == 'host':
+ print("Processing hosts ...")
try:
for host in json_result[1]['entities']:
if 'name' in host['status']:
@@ -425,6 +439,7 @@ def generate_template(json_results):
# CLUSTER #
###########
elif json_result[0] == 'cluster':
+ print("Processing clusters ...")
for cluster in json_result[1]['entities']:
try:
cluster_ip = ((cluster['spec']['resources']['network']
@@ -461,6 +476,7 @@ def generate_template(json_results):
# BLUEPRINT #
#############
elif json_result[0] == 'blueprint':
+ print("Processing blueprints ...")
try:
for blueprint in json_result[1]['entities']:
entity_name = blueprint["status"]["name"]
@@ -486,6 +502,7 @@ def generate_template(json_results):
# APP #
#######
elif json_result[0] == 'app':
+ print("Processing apps ...")
for app in json_result[1]['entities']:
try:
entity_name = app['status']['name']
@@ -508,8 +525,8 @@ def generate_template(json_results):
specify the HTML page template
'''
- current_path = os.path.dirname(sys.argv[0])
-
+ current_path = os.path.dirname(os.path.realpath(__file__))
+
if os.path.isfile(f'{current_path}/templates/nutanixv3.html'):
template_name = f'{current_path}/templates/nutanixv3.html'
else:
@@ -529,7 +546,7 @@ def generate_template(json_results):
vms=str(HTML_ROWS['vm']),
subnets=str(HTML_ROWS['subnet']),
projects=str(HTML_ROWS['project']),
- network_security_rules=str(HTML_ROWS['network_security_rule']),
+ # network_security_rules=str(HTML_ROWS['network_security_rule']),
images=str(HTML_ROWS['image']),
hosts=str(HTML_ROWS['host']),
blueprints=str(HTML_ROWS['blueprint']),
@@ -539,8 +556,8 @@ def generate_template(json_results):
vm_total=str(ENTITY_TOTALS['vm']),
subnet_total=str(ENTITY_TOTALS['subnet']),
project_total=str(ENTITY_TOTALS['project']),
- network_security_rule_total=str(
- ENTITY_TOTALS['network_security_rule']),
+ # network_security_rule_total=str(
+ # ENTITY_TOTALS['network_security_rule']),
image_total=str(ENTITY_TOTALS['image']),
host_total=str(ENTITY_TOTALS['host']),
blueprint_total=str(ENTITY_TOTALS['blueprint']),
@@ -600,7 +617,7 @@ def main():
practices
'''
- current_path = os.path.dirname(sys.argv[0])
+ current_path = os.path.dirname(os.path.realpath(__file__))
'''
make sure our template exists
@@ -656,6 +673,7 @@ def main():
print('Iterating over all supported endpoints ...\n')
for endpoint in endpoints:
+ print(f"Processing {endpoint['name_plural']} ...")
client = ApiClient(
environment_options.cluster_ip,
f'{endpoint["name_plural"]}/list',
diff --git a/python/get_cluster_info_v3/readme.rst b/python/get_cluster_info_v3/readme.rst
index 41f3611..cc4a88b 100755
--- a/python/get_cluster_info_v3/readme.rst
+++ b/python/get_cluster_info_v3/readme.rst
@@ -69,6 +69,13 @@ All the steps below assume you have a terminal session running with the current
- **self.entity_response_length** - Dictates how many entities are returned from a single request. **Maximum** value can be **500**.
- **self.read_timeout** - Increase or decrease depending on the desired timeout delay (in seconds) for each request
+Templates
+=========
+
+An example template has been included with this repository.
+
+- Rename `templates/nutanixv3.html.example` to `templates/nutnixv3.html`, if required.
+
Script Command Line
===================
@@ -160,4 +167,4 @@ These scripts are *unofficial* and are not supported or maintained by Nutanix in
In addition, please also be advised that these scripts may run and operate in ways that do not follow best practices. Please check through each script to ensure it meets your requirements.
-**Changes will be required before these scripts can be used in production environments.**
\ No newline at end of file
+**Changes will be required before these scripts can be used in production environments.**
diff --git a/python/get_cluster_info_v3/requirements.txt b/python/get_cluster_info_v3/requirements.txt
new file mode 100644
index 0000000..491c9b3
--- /dev/null
+++ b/python/get_cluster_info_v3/requirements.txt
@@ -0,0 +1,2 @@
+urllib3==2.2.2
+requests==2.32.3
diff --git a/python/get_cluster_info_v3/templates/nutanixv3.html.example b/python/get_cluster_info_v3/templates/nutanixv3.html.example
new file mode 100644
index 0000000..314bcbe
--- /dev/null
+++ b/python/get_cluster_info_v3/templates/nutanixv3.html.example
@@ -0,0 +1,177 @@
+
+
+
+
+
+ Prism Central Details (API v3)
+
+
+
+
+
+
+
+
+
+
The Prism Central information shown in this page is intended for demo purposes only.
+
Please be aware that the totals shown in parentheses next to each entity type are accurate for each entity type, but includes deleted entities. This is particularly applicable to entities such as blueprints and apps.