FogLAMP Manager Service
Introduction
The FogLAMP Manager Service is a vital component within the FogLAMP Manager that facilitates interactions with FogLAMP instances. Its primary purpose is to manage the configuration changes and operations of FogLAMP instances. Unlike the Monitor service, which solely monitors FogLAMP instances, the Manager Service actively modifies their state. Each FogLAMP Manager Service instance corresponds to a specific FogLAMP instance, allowing multiple instances of FogLAMP to be controlled independently.
Additional Information on Manager Service
Dynamic and Short-Lived Nature
The FogLAMP Manager Services are not persistent microservices within the FogLAMP Manager. Instead, they are created on-demand and exist for a limited duration to fulfill specific management tasks for a given FogLAMP instance. Once their tasks are completed, and there is no new activity, the Manager Services terminate. This approach prevents unnecessary creation and destruction of microservices.
Single Instance per FogLAMP
A single FogLAMP Manager Service is associated with each FogLAMP instance. The microservices are created by the FogLAMP controller in response to requests for service registration. If no Manager Service is registered or in the process of being created, the FogLAMP Manager Controller will create a new FogLAMP Manager microservice.
Supported Services
The FogLAMP Manager Service offers the following services:
Updating the configuration of a FogLAMP instance
Fetching the configuration from a FogLAMP instance
Installing plugins on a FogLAMP instance
Updating the software on a FogLAMP instance
Stopping or restarting a FogLAMP instance
Installing FogLAMP on a new host
Software Management API
The Manager will install software based on its knowledge of the platform on which the FogLAMP is running and the FogLAMP version. It has a complete set of eligible plugins and FogLAMP versions locally stored for installation. Essentially, the Management Service acts as a proxy for the package repository, containing all the packages that the user is entitled to use. In multi-tenant environments, this may be a subset of the total available set of software components.
Asynchronous REST API
The FogLAMP Manager Microservice supports a REST API, similar to other microservices in the FogLAMP Manager. As all operations have indeterminate durations, the API is designed to be asynchronous. It means that the API call will return immediately with an ID representing the requested task. Additional API calls are available to check the state of the tasks being performed by the Manager Service.
Service Lifecycle
The Manager Microservice is started by the FogLAMP Management Controller microservice. It is provided with standard arguments, allowing it to contact the controller, register, and obtain the authentication token. Additionally, the service receives the identity of the FogLAMP instance it manages and an idle timeout period. The service starts a timer with this timeout period, and the timer resets with each API request or task completion.
Task Management
Tasks are executed synchronously within the Manager Service, one at a time and in the order they were requested. The service maintains a task queue, and each task is assigned a unique ID upon addition. Task IDs are not reused within the execution of management tasks, ensuring their uniqueness. Task durations are typically measured in minutes.
Task Semantics
All tasks performed by the FogLAMP Manager Service are transactional to ensure consistency. If a task fails, changes are reverted to restore the target FogLAMP instance to its previous state. This includes reverting altered configuration categories, reinstating added/deleted configuration categories and schedules, and managing software installations and changes.
Installing and Configuring FogLAMP Management Service
Step 1: Install foglamp-service-management
Option 1: Install via Package or Repository
Use the following apt command to install
foglamp-service-management
:sudo apt install -y foglamp-service-management
Option 2: Install using API call (POST request)
Use the following API call to install
foglamp-service-management
:curl -sX POST http://localhost:8081/foglamp/service?action=install -d '{"format":"repository", "name": "foglamp-service-management"}'
Once the installation is complete, you will receive a response confirming the successful installation along with a link to the installation log.
Step 2: Verify the Installation
To verify that the Management Service is installed, make a GET request to the API endpoint:
curl -sX GET http://localhost:8081/foglamp/service/installed | jq
If the installation is successful, the response will include a list of services, and “management” should be listed among them.
Step 3: Add Management Service
To add the Management Service, execute the following API call:
curl -sX POST http://localhost:8081/foglamp/service -d '{"name": "FM Agent", "type": "management", "enabled": "true"}' | jq
You will receive a response confirming the addition of the FM Agent (Management Service) along with an ID.
Step 4: Configure the Management Service
In the FogLAMP GUI, go to Configuration -> FM Agent.
Update the configuration with the following details: - FogMan host: <FogMan IP Address> - Enable: True
Note: For improved security, it is recommended to create a dedicated poll role user in FogLAMP Manage and use those credentials for authentication instead of using admin/fogman.
Step 5: Verify Schedules
Go to Schedules and verify the presence of two schedules: - FM Agent - STARTUP (for Management service) - FogMan Agent Poll - The default INTERVAL schedule will execute every 15 minutes.
To check the schedules via API, use the following command:
curl -sX GET http://localhost:8081/foglamp/schedule | jq
Step 6: Update FogMan Agent Poll Schedule
You can change the schedule type of the FogMan Agent Poll from TIMED to INTERVAL for test runs. This change will make the service execute every 15 minutes.
Step 7: Monitor the FogMan Agent Poll Schedule
Go to FogMan and wait for the FogMan Agent Poll schedule to run. You can watch the syslogs for any updates. To see the list of FogLAMPs, click on the refresh icon in the FogLAMPs list.
Once you have completed these steps, you can proceed with making connections, adding FogLAMP users for certificate-based login, and deploying the system. The Management Service/Agent will then synchronize itself according to the FogMan Agent Poll schedule.