There are two ways to manage blackouts in Foglight - from the UI and from the command line. The options are generally the same. The command line provides us the ability to automate the blackout by using the command line utility in our maintenance scripts in order to enable and clear blackouts.
This document from support gives detailed information on using the command line utility (fglcmd).
I do want to point out this important point regarding blackouts - using the command line method is independent of the UI (dashboard) method.
In this post, we'll start at a very basic level and build from there in future posts.
This is the syntax to put a blackout on alarms in place.
fglcmd -usr foglight -pwd foglight -port 80 -cmd topology:blackoutobject -query "Host where name = 'yow'" -schedulename Always -inheritable
It uses the "blackoutobject" command to turn on the blackout for objects in the "query" - in this case, a host with a name of "yow". It references a schedule name - "Always" - but you can add your own as needed via the Schedules dashboard.
Finally, I tend to specify the "inheritable" flag, so that the sub-types of the object in the query are also blacked out. The query references the "Host" object - but most rules are going to be scoped on a sub-type, eg. cpu or memory. Inheritable blacks out everything underneath the object in the query.
This is what it looks like when I run the command.
There is also a command to list the blackouts that are in effect, based on the query result:
fglcmd -usr foglight -pwd foglight -port 80 -cmd topology:blackouts -query "Host where name = 'yow'"
We replace "blackoutobjects" with "blackouts" and drop the scheduleName and inheritable flags.
Finally, the blackout on the objects in the query can be lifted (removed) with the -clear flag:
fglcmd -usr foglight -pwd foglight -port 80 -cmd topology:blackoutobject -query "Host where name = 'yow'" -clear
I noted above that the blackouts enabled via command line do not appear in the Blackouts dashboard. That is true. But, every object in Foglight has a "isBlackedOut" property (Boolean). You can create a simple drag 'n drop dashboard of your hosts (or other objects) that include the name and that property.
In my example above, I used "name = 'something' " as my topology query. I could've used the like operator to match a pattern as shown below.
In the next post on automating blackouts, we'll show how to add objects to a service definition (via Service Builder) and use that to enable blackouts.
Finally, take note that when you run the fglcmd to blackout an object, it is at a point in time that the command is run. If I were to add another host to Foglight with "yow" in the name, it wouldn't be blacked out. I'd have to run the command again. We'll see in a future post how to automate that. Stay tuned!