Log Insight Alerts: SNMP and Scripts

As you know, Log Insight allows for user alerts to be configured for queries through the UI. These alerts can trigger an email and/or vC Ops notification event. In Log Insight 2.0, it is possible to configure additional ways to trigger a user alert through the CLI. I would like to discuss these additional options available.

User alerts in the UI

For information about alerts in the UI, see this post.

User alerts log file

In Log Insight 2.0, an alert.log file was introduced and can be found at:


Within the file each line represents a user alert. A line consists of a JSON string that looks like:

{“Data”:{“Name”:”High SCSI Latency”,”Data”:{“Count”:1206317,”Fields”:{“deviceId”:”naa.6001405b9e05a9cd8c34d38e8daad8d5″}},”HitCount”:1,”Url”:”″,”EditUrl”:”″},”Timestamp”:”2014-08-18T14:17:08.081Z”}

The format of the JSON string is:

  • Data
    • Name (string)
    • Data
      • Count (number)
      • Fields (key:value)
    • HitCount (number)
    • URL (string)
    • EditURL (string)
  • Timestamp (string)


Given the alert.log file, if you compile snmptrapd and copy the executable to the LI VA then you could send SNMP traps in response to user alerts.
As a side note, you can also send snmptraps through vCenter Operations Manager integration by configuring an alert be sent to vCenter Operations Manager and configuring vCenter Operations Manager to send an SNMP trap as desired.


The alert.log file allows for a custom script to be run from the Log Insight virtual appliance. This custom script could be used to notify another system or could execute some set of commands in response to an alert (e.g. to attempt to fix the problem discovered).  For example,

#!/usr/bin/env bash
for a in $(tail -f /storage/var/loginsight/alert.log); do
    if [ $(echo $a | awk '{ split($0,a,"hostname"); split(a[2],b,"\""); print b[3]}') == "ESXi syslog stopped working" ]; then
        ssh root@$(echo $b | awk '{ split($0,a,"hostname"); split(a[2],b,"\""); print b[3]}') "esxcli system syslog reload"

In the above example, Log Insight will restart the syslog process on ESXi hosts if they stop forwarding syslog events (a known issue in certain versions of ESXi).


As you can see there are other ways to trigger and respond to alerts in Log Insight. If you are interested in seeing other options natively in the UI, be sure to vote from them on https://loginsight.vmware.com:

If you are looking for other options on how to leverage the alerts.log file, be sure to check out Matt Cowger’s post here.

© 2014, Steve Flanders. All rights reserved.

5 comments on “Log Insight Alerts: SNMP and Scripts

What would be awesome if you could automate a powercli command (sort of like the power actions fling but alert driven).

Well, technically you could – have a PS script monitor the alerts.log file on the LI VA 🙂 Also looks like there are a couple ways to get PS in Linux though I have not tried them out yet.

I think the biggest thing is the linux Windows part. To monitor the alerts.log would need some sort of CIFS share on LI or go the other way and have LI push the alerts.log to a location that the Windows server running PS can get to it (using ftp or samba mounts or something of that nature).

A couple of options today would be to forward the log via syslog to another destination or via PS (and a SSH key) connect via the CLI.

I was thinking of the latter (ssh key on the windows PS system), but would have to figure out how to keep track of the location in the alert.log file.

Leave a Reply

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

Back To Top