The rich, interactive Foglight UI allows you to monitor your critical business services, applications and technical infrastructure. It also provides a mechanism to manage that infrastructure, and the administration of your Foglight implementation, without using the Foglight UI. The Foglight command-line interface lets you automate your business logic by writing scripts, deploy and create agents, install and activate cartridges, create and manage users, manage licenses and many other tasks.
For today's blog entry, we are going to focus on the administration of your Foglight implementation from the command line. Let's jump right in and take a look at the structure of the command-line expression:
fglcmd connection_options -cmd scope:command options
The scope defines the types of commands and the target entity we use it against. There are many possible scope values available for use:
| Scope |
Description |
| agent |
Manages agents and clients |
| cartridge |
Manages cartridges |
| license |
Manages licenses |
| schedule |
Lists schedules |
| script |
Runs scripts |
| security |
Creates and manages users, roles and groups |
| support |
Creates support bundles |
| topology |
Assigns blackout schedules |
| util |
Contains utility commands |
So how do i run this? You can do it in one of three ways:
1) Locally on the Foglight Management Server, by navigating to /bin. You can then execute the command-line expression as you will soon see.
2) Running it on a remote computer in your monitored environment. To do that, you will need to copy /tools/fglcmd.zip file from the Foglight Management Server to the remote computer. Next, unzip that file and proceed as in 1) above.
3) Running it on the Foglight Management Server as part of a script
To see all of the administrative commands - and descriptions - that are available to you, you can simply run fglcmd with the following syntax:
fglcmd -usr foglight -pwd foglight -cmd commands (change usr and pwd as necessary)
This will return a list of all of the commands, grouped by scope. It should look like this:
agent:
activate Activates an agent.
clients Shows a list of known clients.
create Creates an instance of an agent.
deactivate Deactivates an agent.
delete Deletes an agent.
deploy Deploys an agent.
getlog Fetches a specific agent log file.
list Shows a list of known agents.
logs Shows a list of agent log files.
packages Shows a list of available agent packages.
setschedule Assigns a blackout schedule to a Foglight agent.
start Starts an agent.
stop Stops an agent.
types Shows a list of known agents by agent host name.
cartridge:
disable Deactivates an installed Foglight cartridge.
enable Activates an installed Foglight cartridge.
install Installs and activates (on by default) a Foglight cartridge.
list Lists all installed Foglight cartridges.
uninstall Uninstalls a Foglight cartridge.
license:
import Installs a license.
list Shows a list of installed licenses.
remove Removes a license.
schedule:
list Shows a list of all Foglight schedules.
script:
run Runs a script.
security:
assigngroup Assign a user to a group.
assignrole Assign a group to a role.
creategroup Create a group.
createuser Create a user.
deletegroup Delete a group.
deleteuser Delete a user.
support:
bundle Creates a support bundle.
topology:
blackoutobject Assigns a blackout schedule to topology object(s).
util:
configexport Exports Foglight monitoring policy.
configimport Imports a Foglight monitoring policy.
env Display Foglight server configurations.
metricexport Exports metric observations by query.
topologyexport Exports topology object's properties.
uiexport Exports a WCF module.
uiimport Imports a WCF module.
uilist Shows a list of deployed WCF modules.
For the remainder of the blog entry, I will focus on a couple of the most commonly used (by me) commands. The 'Command Line Reference' document on Quest SupportLink or provided with your Online Help has all you would need on this topic. Or feel free to simply try them all out.
If you ever run into a problem with Foglight, generating a Support Bundle should be the first thing you do. This allows Technical Support with a large amount of valuable information in a single file.
[safoglight@torpsv012 bin]$ ./fglcmd.sh -usr foglight -pwd foglight -cmd support:bundle -f ../support/test.supportbundle.zip
[safoglight@torpsv012 bin]$ ls -l ../support/
total 1392
-rw-rw-rw- 1 safoglight safoglight 1411586 Aug 7 11:00 test.supportbundle.zip
This can be very useful as part of a script, where you wish to create a large number of users and do not wish to use LDAP. You can script the creation of the users and assignation of those users to groups and roles.
[safoglight@torpsv012 bin]$ ./fglcmd.sh -usr foglight -pwd foglight -cmd security:createuser -username testuser -password testusername11
fglcmd allows you the ability to list, create, deploy, delete, start, stop agents from the command line. Again, this could be useful in large environments where you wish to create and deploy manay agents. This could be achieved using a script and fglcmd in concert.
[safoglight@torpsv012 bin]$ ./fglcmd.sh -usr foglight -pwd foglight -cmd agent:list all -host questdc1.quest.local
Host: questdc1.quest.local
ID: 2
Name: QUESTDC1_WIN
Type: Windows_System
Version: 5.2.2 (Build: 522-20080604-0500)
Namespace: SPI
Adapter ID: SPI
Status: Active/Collecting data
------------------------------------
Host: questdc1.quest.local
ID: 6
Name: MedRec_11
Type: FTR
Version: 1.0.0 (Build: 5.2.2)
Namespace: SPI
Adapter ID: SPI
Status: Active/Collecting data
------------------------------------
Host: questdc1.quest.local
ID: 21
Name: 0
Type: SPINetwork
Version: 5.2.2 (Build: 522-20080604-1002)
Namespace: SPI
Adapter ID: SPI
Status: Active/Collecting data
------------------------------------
Host: questdc1.quest.local
ID: 36
Name: AD_questdc1
Type: Custom_ADAgent
Version: 0.0.1
Namespace: SPI
Adapter ID: SPI
Status: Active/Collecting data
------------------------------------
Host: questdc1.quest.local
ID: 37
Name: Exchange_questdc1
Type: Custom_ExchangeAgent
Version: 0.0.1
Namespace: SPI
Adapter ID: SPI
Status: Active/Collecting data
------------------------------------
Hopefully this has given you a taste for the power of the command line interface and will entice you to give it a try. If you have any questions, problems or even your own examples you would like to share please feel free to post in the Comments section.
Kind regards
Gowdy