Search This Blog

Monday, 31 July 2023

Handling Infra Issues

 1. ESXI Host connection not responding 

Ping  Esxi Host from VC

Tracert log

Ping default gateway

check the vLAN number 

Check what IP host got?

Check if host able to get IP from DHCP

check DNS resolution 

 

902  - UDP - Incomming - ESXi Management IP addresses - vCenter Server Management IP address - Core management communications between vCenter Server and ESXi (vpxd)

Powershell : 

Test-NetConnection ESXI_HOST_NAME -port 902 -InformationLevel Detailed

Python: 

import socket as sock
create_socket = sock.socket(sock.AF_INET, sock.SOCK_STREAM)

destination = ("ESXI_HOST_NAME", 902)

result = create_socket.connect_ex(destination)

if result == 0 :
    print("Port is open")
else:
    print("Port is not open")

create_socket.close()

Python Tips and tricks

 num1 = 1_000_000_000

num2 = 2_000
ans = num1*num2
print(f'{ans:_}')
print(f'{ans:,}')

2_000_000_000_000 2,000,000,000,000

# Get frequently occurring item from the list
x = [1,2,1,3,4,1,2,4,1]
most = max(set(x), key=x.count)
print(most)
1

# Tuples insert a item into a tuple list

myTuple = ([1,2],[3])
myTuple[1].append(4)
print(myTuple)
([1, 2], [3, 4])

# Clean python input Handling

def do_this():
    print('Doing this')

def do_that():
    print('Doing that')

match input('Do this or that? '):
    case 'this':
        do_this()
    case 'that':
        do_this()
    case _:
        print('Invalid Input!')



Wednesday, 26 July 2023

Run script on VM

 $vm | Invoke-VMScript -ScriptText “systemctl restart crond” -GuestUser root - GuestPassword ***

Ansible_Notes

   ansible -i inventory.ini -m ping all   # inventory.ini it will ping to the hosts which are in inventory # ansible -i inventory.ini -m pin...