# Heartbeat
This document describes how the Sermant plugin uses the heartbeat function.
Heartbeat is one of the core services in Sermant core module (opens new window). An instance of heartbeatService is obtained by:
HeartbeatService heartbeatService = ServiceManager.getService(HeartbeatService.class);
The heartbeat service starts execution when it is initialized, and periodically sends the name, version and other information of each plugin to the backend server. Currently, plugin heartbeats report information like:
hostname
: The hostname of the sending clientip
: The ip of the sending clientapp
: Application name, as well asappName
in startup parametersappType
: Application type,as well asappType
in startup parametersheartbeatVersion
: Time of last heartbeatlastHeartbeat
: Time of last heartbeatversion
: The version of the core package, as well as thesermant-version
value of the core packagemanifest
filepluginInfoMap
: Current Sermant carried plugin informationpluginName
: Plug-in name, which can be determined in the plug-in configuration filepluginVersion
: Plug-in version, which is theSermant-plugin-version
value of themanifest
file in the plugin jarextInfo
: Additional content that the plug-in wants to report in the data that the plug-in reports
If you want to add additional content to the data reported by the plugin, you can call the following API:
// use ExtInfoProvider to add additional content
heartbeatService.setExtInfo(new ExtInfoProvider() {
@Override
public Map<String, String> getExtInfo() {
// do something
}
});