Mostrando postagens com marcador esxi. Mostrar todas as postagens
Mostrando postagens com marcador esxi. Mostrar todas as postagens

Unlock ESXi root account

1. Access ESXi console with remote or direct KVM or ILO

2. Login to ESXi console (F2) with root account (it won't be locked at this level)

3. Navigate to Troubleshooting Options

4. In first line you should see either Disable or Enable ESXi Shell. If its Enable, hit enter once.

5. Then use combination Alt+F1 to switch to ESXi shell

6. Login with root account (it won't be locked at this level)

7. Run following command. This will show number of failed login attempts

pam_tally2 --user root

8. To reset the failures, run following command

pam_tally2 --user root --reset

 
Now you can access the ESXi with shell and Web UI (vSphere Client).

Run 'pam_tally2 --user root' couple of times to check if there are new failed login attempts.

 

ESXI enalbe SNMP

 Run through ssh (it's  all in one line)

esxcli system snmp set -r && esxcli system snmp set -c COMMUNITY && esxcli system snmp set -p 161 && esxcli system snmp set -C CONTACTA_MAIL && esxcli system snmp set -L "LOCATION" && esxcli system snmp set -e yes
 

Zabbix collect vSphere info

1) Create vSphere host
2) Add 3 macros:
- {$USERNAME} - username which has an administrative privileges on VMware
- {$PASSWORD) - password for username
- {$URL} - https://10.10.10.10/sdk (where 10.10.10.10 is the address of vSphere host, not VMware supervisor)
- {$UUID} - vsphere UUID - https://host/mob/?moid=ha-host&doPath=hardware.systemInfo
3) Add 3 templates to vSphere host:
- Template Virt VMware
- Template Virt VMware Guest
- Template Virt VMware Hypervisor

Enable Object Browser in vSphere 6.x

Starting with vSphere 6.0 the Managed Object Browser is disabled by default to avoid malicious configuration changes or actions. You can enable and disable the Managed Object Browser manually.

To enable or disable the Managed Object Browser by using the vSphere Client connected directly to the ESXi host, complete the following steps:

1 - In the vSphere Client, select the host in the inventory.
2 - In the right pane, click the Configuration tab.
3 - Under Software, select Advanced Settings.
4 - From the left pane of the Advanced Settings dialog box, select Config > HostAgent > plugins > solo.
5 - Select or deselect Config.HostAgent.plugins.solo.enableMob to enable or disable the Managed Object Browser.

To enable or disable the Managed Object Browser by using the vSphere Web Client, complete the following steps:

1 - Browse to the host in the vSphere Web Client navigator.
2 - On the Manage tab and click Settings.
3 - Under System, select Advanced System Settings.
4 - Select the Config.HostAgent.plugins.solo.enableMob option and click Edit to enable or disable the Managed Object Browser.

ESXI CLI

Activate SNMP on VSphere client
Configuration -> Security Profile -> Firewall -> Properties -> SNMP


Connect to ESXI using SSH and run the command below, changing community, contact email and location:

esxcli system snmp set -r && esxcli system snmp set -c public && esxcli system snmp set -p 161 && esxcli system snmp set -C contact@domain.com && esxcli system snmp set -L "City, State" && esxcli system snmp set -e yes


#firewall all hosts
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
#firewall for specific network
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 10.20.0.0.0/23
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
#restart snmp
/etc/init.d/snmpd restart 



Set time:
esxcli system time set -d 31 -M 1 -y 2012 -H 18 -m 0 -s 0

source: https://kb.vmware.com/s/article/1003736


View log in browser:

https://server_ip_or_name/host/syslog.log





Use the Direct Console User Interface (DCUI) over ssh



1 - Browse to the host in the vSphere Web Client inventory.
2 - Click the Manage tab and click Settings.
3 - Under System, select Security Profile.
4 - In the Services panel, click Edit.
5 - Select a service from the list.

        ESXi Shell
        SSH
        Direct Console UI
      
6 - Click Service Details and select the startup policy Start and stop manually.
When you select Start and stop manually, the service does not start when you reboot the host. If you want the service to start when you reboot the host, select Start and stop with host.
7 - Select Start to enable the service.
8 - Click OK.

9 - Access the server over ssh andrun

dcui

ctrl+c to exit

ESXi Retrieving Networking Information

Linux commands for retrieving networking information are not included in the ESXi Shell. You can instead use ESXCLI commands.

On ESXi 5.0, ifconfig information is the information for the VMkernel NIC that attaches to the Management Network port group. You can retrieve that information by using ESXCLI commands.

    esxcli network ip interface list

    esxcli network ip interface ipv4 get -n vmk<X>

    esxcli network ip interface ipv6 get -n vmk<X>

    esxcli network ip interface ipv6 address list


You can retrieve information about DNS with the esxcli network ip dns command in the following two namespaces:

    esxcli network ip dns search

    esxcli network ip dns server


For information corresponding to the Linux netstat command, use the following ESXCLI command.

    esxcli network ip connection list

Shutdown VMWare guests


Method 1

#list Vms
vim-cmd vmsvc/getallvms

#get power state
vim-cmd vmsvc/power.getstate "VMID"

#Shutdown

vim-cmd vmsvc/power.shutdown "VMID"

Note: If the virtual machine fails to shut down, run this command:

vim-cmd vmsvc/power.off "VMID"


Method 2

#Get Vms info
esxcli vm process list |grep -i World |cut -d: -f2

#shutdown Vm
esxcli vms vm kill --type= [soft,hard,force] --world-id= WorldNumber
ex: esxcli vm process kill -w 69237 -t soft 


Enable wol in vmware host

list network adapters
esxcli network nic list

check if network adapter supports wake-on-lan and it is enabled
esxcli network nic get -n vmnic0 | grep Wakeon

enable wol in network adapter, add this line before the line init 0 in local.sh file
vi /etc/rc.local.d/local.sh

ethtool -s vmnic0 wol g

Apt only upgrade selected packages

 apt list --upgradable | cut -d"/" -f1 > /tmp/apt pico /tmp/apt cat /tmp/apt | tr "\n" " " apt install --on...

Mais vistos