ESXi Kickstart Dashboard in Log Insight

By | September 30, 2014

I recently was in the Middle East for work, so everything in my life was put on hold, including this blog.

Hopefully I can jump start things with a quick post.

I am an advocate of Log Insight, I seem to find more uses for it the more I work with it and the product just keeps getting better every couple of months. Earlier this year I stumbled across a blog post by Chris Todd called “Integrate Anything with Log Insight Using Syslog

I just thought that was so cool that I could send any message to LI instead of other methods including my old tried-and-true method of email (via sendmail). I actually had a good notification process to replace. During my ESXi kickstarts (not pure esxi pxe, I PXE into the HP Scripting Toolkit). During each part of the toolkit I would send emails to a group inbox telling the section that was completed and sending the log at the end of the process.

The emails worked OK, but sometimes I had issues with our corporate email filter thinking that these emails were spam. My thoughts were that I could send this same info to Log Insight AS WELL AS create a simple dashboard to track builds (useful for sxheduled patching as well as our greenfield deployment).

The main tweaks I had to do were around the hostname (scripting toolkit creates a random name but I had the name in an env variable) and the netcat format (didn’t use udp or the w option).

This is a bash script called send2li based on the script from Chris Todd

I also created a separate script called sendfile2li for sending a file instead of from the pipe (almost identical to send2li). The script takes a single argument (the file that you are trying to send). This was helpful for sending a log file I was maintaining.

I would then put the following in some of my wrapper scripts

echo -e “esxi_install: Started” | ${TOOLKIT}/scripts/send2li
echo -e “pxe: Started” | ${TOOLKIT}/scripts/send2li

echo -e “esxi_install: Completed” | ${TOOLKIT}/scripts/send2li
echo -e “pxe: Completed” | ${TOOLKIT}/scripts/send2li

To send the log file I would use:

${TOOLKIT}/scripts/sendfile2li ${TOOLKIT}/pxelog

The ${TOOLKIT} variable is one that is set a part of the HP Scripting Toolkit environment.

 

Note that you can use the nc command from within esxi, so in your kickstart ks.cfg file you can use the nc command to signal the start and end of a build as well (or for whatever reasons). I believe that version of netcat supports the flags in Chris Todd’s article as well.

pxe-ia

As seen above, I extracted the field that contains ‘pxe’ and the field that contains ‘completed’ (called Build_Phase and Build_Phase_Status).

I then built a query which was the basis for all of the dashboards:

pxe-query

Unique Count of Build_Phase grouped by Build_Phase_Status, hostname, use a Column Chart and add a filter “Build Phase” Contains pxe

 

I then created a dashboard by having the same query but change the build_phase filter

pxe-dashboard

 

Now, when we rebuild the hosts, i can track each host by phase or by overall status. If there is only a started and not a completed, then the host got hung up somewhere and probably needs attention. This dashboard is really a simple implementation, but it puts together two different concepts (integrating anything to log insight and creating dashboards). Now that 2.0 also supports the API, the integration can have been sent via JSON format (using cURL I believe), but that is very un-unix-like :-). I can see that this would work if you don’t have access to a unix-style command prompt.

Leave a Reply

Your email address will not be published. Required fields are marked *