34 lines
847 B
Plaintext
34 lines
847 B
Plaintext
---
|
|
layout: docs
|
|
page_title: Base Plugin
|
|
description: Learn about how to author a Nomad Autoscaler plugin.
|
|
---
|
|
|
|
# Base Plugin
|
|
|
|
The base plugin is an interface required of all autoscaler plugins,
|
|
providing a set of common operations.
|
|
|
|
## Plugin API
|
|
|
|
#### `PluginInfo() (*PluginInfo, error)`
|
|
|
|
A `PluginInfo` contains metadata about the plugin. For example,
|
|
the Prometheus APM plugin returns the following;
|
|
|
|
```go
|
|
PluginInfo{
|
|
// Name of the plugin
|
|
Name: "prometheus",
|
|
// Plugin type: "apm", "strategy", or "target"
|
|
PluginType: "apm"
|
|
}
|
|
```
|
|
|
|
#### `SetConfig(config map[string]string) error`
|
|
|
|
The `SetConfig` function is called when starting an instance of the plugin. It contains the
|
|
configuration for a named instance of the plugin as provided in the autoscaler [agent config][plugin_config].
|
|
|
|
[plugin_config]: /docs/autoscaling/agent
|