VMware Cloud Community
Sunemaster
Contributor
Contributor

Alarms on datastore usage

Hi all,

I need a little help again...

I'm trying to create a custom alarm, that triggers when datastore usage goes too high.

We have an internal monitoring application that i want to trigger, and the easiest way i can do this, is by simply creating a file on the vCenter Server.

I've set the following:

2066394.png

And the script content:

@Echo Off

SetLocal

cd /d "%~dp0"

Set "LocalDir=C:\SLA\Output\ESX_Datastore_Usage"

:doIt

Set "OutputFile=%VMWARE_ALARM_TARGET_NAME%_%VMWARE_ALARM_NEWSTATUS%.txt"

If Exist "%LocalDir%\%VMWARE_ALARM_TARGET_NAME%_*.txt" (

                             Del /Q "%LocalDir%\%VMWARE_ALARM_TARGET_NAME%_*.txt"

)

If /I %VMWARE_ALARM_NEWSTATUS%==green (

                             Goto End

)

Set VMWARE > "%LocalDir%\%OutputFile%"

Goto End

:End

EndLocal

Exit

However, it seems that nothing happens when the alarm gets cleared again.

That is, i'm expecting the script to actually delete all files related to a given datastore, and then skip creating a new one if the "alarm" is green.

But when the alarm clears, the script is not being run, apparently.

Looking at the options in the above screenshot, there's no "Red to Green" action, only "Yellow to Green". Could it be that simple?

I noticed that "..._OLDSTATUS" is always "Gray", no matter what the previous state was.

Any ideas or input is more than welcome.

If there's a smarter/simpler way of doing this, please do let me know. 🙂

Thanks a lot.

--

/Sune T.

0 Kudos
0 Replies