Collects state metrics from your Nagios installation by monitoring the Nagios status.dat file and presents them to the Snap system.
- golang 1.8+ (needed only for building)
All OSs currently supported by snap:
- Linux/amd64
- Darwin/amd64
For Snap, check here.
Fork https://github.com/SignifAi/snap-plugin-collector-nagios
Clone repo into $GOPATH/src/github.com/SignifAi/
:
$ git clone https://github.com/<yourGithubID>/snap-plugin-collector-nagios.git
The following provides instructions for building the plugin yourself if you decided to download the source. We assume you already have a $GOPATH setup for golang development. The repository utilizes glide for library management.
build:
make
testing:
make test
- Set up the Snap framework
Once the framework is up and running, you can load the plugin.
$ snaptel plugin load snap-plugin-collector-nagios
Plugin loaded
Name: nagios
Version: 1
Type: collector
Signed: false
Loaded Time: Sat, 18 Mar 2017 13:28:45 PDT
You need to create or update a task file to use the Nagios collector plugin. We have provided an example, _examples/tasks/nagios-status-task.yaml shown below. In our example, we utilize the psutil collector so we have some data to work with. There is one (1) configuration setting you can use.
Setting | Description | Required? |
---|---|---|
status_file | The Nagios status file to monitor states from | Yes |
The status file is your Nagios installation's status.dat file, usually found in $NAGIOS_ROOT/var/status.dat . It is the same file the CGI scripts use to present host and service statuses. This is where we collect state metrics from for the whole Nagios installation.
version: 1
schedule:
type: "simple"
interval: "1s"
count: 5
max-failures: 10
workflow:
collect:
config:
metrics:
/nagios/*/acknowledged: {}
/nagios/*/state: {}
/nagios/*/services/*/acknowledged: {}
/nagios/*/services/*/state: {}
publish:
- plugin_name: "file"
config:
file: "/tmp/nagios-metrics.log"
Once the task file has been created, you can create and watch the task.
$ snaptel task create -t examples/tasks/nagios-status-task.yaml
Using task manifest to create task
Task created
ID: 72869b36-def6-47c4-9db2-822f93bb9d1f
Name: Task-72869b36-def6-47c4-9db2-822f93bb9d1f
State: Running
$ snaptel task list
ID NAME
STATE ...
72869b36-def6-47c4-9db2-822f93bb9d1f
Task-72869b36-def6-47c4-9db2-822f93bb9d1f Running ...
The most immediately helpful way you can benefit this plug-in is by cloning the repository, adding some further examples and submitting a pull request.
Released under the Apache 2.0 License.
- Author: @SignifAi
- Info: www.signifai.io