VMware vSphere

 View Only
  • 1.  esxcli system syslog reload

    Posted Feb 25, 2013 04:01 PM

    I have quite a few ESXi servers. I am just getting started with centralized logging using Splunk. I have done much research on this issue; if you make any change to syslog configuration values OR if there is ANY break in the communication between the host(s) and the syslog server, the syslog service needs to be reloaded on each ESXi host.

    My question; is there a better/easier way for me to restart the syslog service on all of my ESXi hosts, then enabling SSH on each host, SSHing to each host and running the command esxcli system syslog reload?

    There has to be a better way.

    Thanks all!



  • 2.  RE: esxcli system syslog reload
    Best Answer

    Posted Feb 25, 2013 04:54 PM

    Deploy the vMA. The vMA then connects to the vCenter server and can make these requests to the hosts. You can create a quick script to restart the syslog daemon.

    You ssh into vMA but it usess a seperate protocol to talk to your vcenter and hosts. Here is the link to download and documentation.

    http://www.vmware.com/support/developer/vima/



  • 3.  RE: esxcli system syslog reload

    Posted Feb 25, 2013 06:19 PM

    Thanks vSchu. I downloaded the vMA right after posting this discussion. Thanks for the link to the DOC - I hope it is pretty straight forward (I'm no coder).



  • 4.  RE: esxcli system syslog reload

    Posted Feb 25, 2013 06:41 PM

    I am definately no coder. I need to get into scripting a little more. One thing to look into is vmfp (vm fast pass). This will allow quicker authentication in. So you use the normal esxcli commands but then specifiy the targets. If you wanted to write a loop or script that would do on all your hosts that would be ideal. I am no coder so worst case I put it in a text file on my computer and copy paste in and let it do each host by line.

    Good luck!



  • 5.  RE: esxcli system syslog reload

    Posted Feb 25, 2013 08:08 PM

    Dave,

      You are in luck, i just did this myself.

    From the VMA you can populate a file like hosts.txt with all the hostnames and run it against that.  Save this in a file like syslogreload.sh and set chmod u+x or copy and paste the text below /bin/bash once you have hosts.txt populated

    #! /bin/bash

    for host in $(cat hosts.txt)

    do

    echo starting $host

    esxcli -s $host -u root --password 'pass' system syslog reload

    echo $host done

    done

    In powercli you can do the same like this if connected to Vcenter already and you are comfortable.  You can also change to Get-Datacenter and pipe that.

    $cluster = Read-Host "Enter Cluster Name"

    foreach ($server in (Get-Cluster $cluster | Get-VMHost | where {$_.ConnectionState -eq "Maintenance"})){
         $esxcli = Get-EsxCli -VMHost $server
         $esxcli = Get-EsxCli
         $esxcli.system.syslog.reload()
    }