├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── CHANGES ├── CONTRIBUTING.md ├── LICENSE.txt ├── Makefile ├── NOTICE.txt ├── README.BUILD.md ├── README.md ├── _meta ├── beat.docker.yml ├── beat.yml └── fields.yml ├── beater └── nagioscheckbeat.go ├── blog ├── README.md ├── apache │ ├── Dockerfile │ ├── check_apachestatus.pl │ ├── httpd.conf │ ├── nagioscheckbeat.yml │ └── run-stuff.sh ├── docker-compose.yml ├── elasticsearch │ ├── Dockerfile │ └── config │ │ ├── elasticsearch.yml │ │ ├── logging.yml │ │ └── scripts │ │ └── monitor-hosts.groovy ├── hammer.sh ├── kibana-dashboard.json ├── kibana │ ├── Dockerfile │ ├── config │ │ └── kibana.yml │ └── run-stuff.sh ├── mysql │ ├── Dockerfile │ ├── check_mysql_health-2.2.1.tar.gz │ ├── check_redis.pl │ ├── install-check.sh │ ├── nagioscheckbeat.yml │ └── run-stuff.sh ├── redis │ ├── Dockerfile │ ├── check_redis.pl │ ├── nagioscheckbeat.yml │ └── run-stuff.sh ├── watch-heartbeat.sense └── watch-thresholds.sense ├── check ├── check.go └── check_test.go ├── cmd └── root.go ├── config ├── config.go └── config_test.go ├── data └── meta.json ├── docs ├── fields.asciidoc └── index.asciidoc ├── fields.yml ├── include └── fields.go ├── logs └── nagioscheckbeat ├── magefile.go ├── main.go ├── main_test.go ├── make.bat ├── nagioscheckbeat-sar-example.yml ├── nagioscheckbeat.docker.yml ├── nagioscheckbeat.osx.yml ├── nagioscheckbeat.reference.yml ├── nagioscheckbeat.yml ├── nagiosperf ├── nagiosperf.go └── nagiosperf_test.go ├── ss.png └── tests └── system ├── config └── nagioscheckbeat.yml.j2 ├── nagioscheckbeat.py ├── requirements.txt └── test_base.py /.editorconfig: -------------------------------------------------------------------------------- 1 | # See: http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | 10 | [*.json] 11 | indent_size = 4 12 | indent_style = space 13 | 14 | [*.py] 15 | indent_style = space 16 | indent_size = 4 17 | 18 | [*.yml] 19 | indent_style = space 20 | indent_size = 2 21 | 22 | [Makefile] 23 | indent_style = tab 24 | 25 | [Vagrantfile] 26 | indent_size = 2 27 | indent_style = space 28 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pl linguist-detectable=false 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /build 3 | /vendor 4 | 5 | .DS_Store 6 | /nagioscheckbeat 7 | /nagioscheckbeat.test 8 | *.pyc 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: trusty 3 | services: 4 | - docker 5 | 6 | language: go 7 | 8 | go: 9 | - 1.11.2 10 | 11 | os: 12 | - linux 13 | - osx 14 | 15 | env: 16 | matrix: 17 | - TARGETS="check" 18 | - TARGETS="testsuite" 19 | 20 | global: 21 | # Cross-compile for amd64 only to speed up testing. 22 | - GOX_FLAGS="-arch amd64" 23 | 24 | addons: 25 | apt: 26 | packages: 27 | - python-virtualenv 28 | 29 | before_install: 30 | - umask 022 31 | # Redo the travis setup but with the elastic/libbeat path. This is needed so the package path is correct 32 | - mkdir -p $HOME/gopath/src/github.com/PhaedrusTheGreek/nagioscheckbeat/ 33 | - rsync -az ${TRAVIS_BUILD_DIR}/ $HOME/gopath/src/github.com/PhaedrusTheGreek/nagioscheckbeat/ 34 | - export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/PhaedrusTheGreek/nagioscheckbeat/ 35 | - cd $HOME/gopath/src/github.com/PhaedrusTheGreek/nagioscheckbeat/ 36 | 37 | install: 38 | - true 39 | 40 | script: 41 | - make $TARGETS 42 | 43 | after_success: 44 | # Copy full.cov to coverage.txt because codecov.io requires this file 45 | -------------------------------------------------------------------------------- /CHANGES: -------------------------------------------------------------------------------- 1 | 0.6.0 2 | - Updated to Elastic Stack 5.x Libbeat. Provides auto-installing templates, among other great changes. 3 | - Using new Cookie Cutter framework for Packaging, Docs & Template generation 4 | - Changed period settings to be a time.Duration variable instead of a parsed STring 5 | - Updated PublishEvents for libbeat changes (was no longer available in beat.Events.PublishEvents(), moved to client.PublishEvents() 6 | 0.5.4 7 | - added numerical status_code to check output 8 | 0.5.3 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhaedrusTheGreek/nagioscheckbeat/d67fb558ab997869e2c6e8c30fee8e84de5336fd/CONTRIBUTING.md -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Jay Greenberg 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BEAT_NAME=nagioscheckbeat 2 | BEAT_PATH=github.com/PhaedrusTheGreek/nagioscheckbeat 3 | BEAT_GOPATH=$(firstword $(subst :, ,${GOPATH})) 4 | SYSTEM_TESTS=false 5 | TEST_ENVIRONMENT=false 6 | ES_BEATS?=./vendor/github.com/elastic/beats 7 | LIBBEAT_MAKEFILE=$(ES_BEATS)/libbeat/scripts/Makefile 8 | GOPACKAGES=$(shell govendor list -no-status +local) 9 | GOBUILD_FLAGS=-i -ldflags "-X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.buildTime=$(NOW) -X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.commit=$(COMMIT_ID)" 10 | MAGE_IMPORT_PATH=${BEAT_PATH}/vendor/github.com/magefile/mage 11 | NO_COLLECT=true 12 | 13 | # Path to the libbeat Makefile 14 | -include $(LIBBEAT_MAKEFILE) 15 | 16 | # Initial beat setup 17 | .PHONY: setup 18 | setup: pre-setup git-add 19 | 20 | pre-setup: copy-vendor git-init 21 | $(MAKE) -f $(LIBBEAT_MAKEFILE) mage ES_BEATS=$(ES_BEATS) 22 | $(MAKE) -f $(LIBBEAT_MAKEFILE) update BEAT_NAME=$(BEAT_NAME) ES_BEATS=$(ES_BEATS) NO_COLLECT=$(NO_COLLECT) 23 | 24 | # Copy beats into vendor directory 25 | .PHONY: copy-vendor 26 | copy-vendor: 27 | mkdir -p vendor/github.com/elastic 28 | cp -R ${BEAT_GOPATH}/src/github.com/elastic/beats vendor/github.com/elastic/ 29 | rm -rf vendor/github.com/elastic/beats/.git vendor/github.com/elastic/beats/x-pack 30 | mkdir -p vendor/github.com/magefile 31 | cp -R ${BEAT_GOPATH}/src/github.com/elastic/beats/vendor/github.com/magefile/mage vendor/github.com/magefile 32 | 33 | .PHONY: git-init 34 | git-init: 35 | git init 36 | 37 | .PHONY: git-add 38 | git-add: 39 | git add -A 40 | git commit -m "Add generated nagioscheckbeat files" 41 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | nagioscheckbeat 2 | Copyright 2019 Jay Greenberg 3 | 4 | This product includes software developed by The Apache Software 5 | Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /README.BUILD.md: -------------------------------------------------------------------------------- 1 | 1. Set up your golang environment 2 | 3 | 2. Download Me and my Dependencies 4 | 5 | ``` 6 | go get github.com/PhaedrusTheGreek/nagioscheckbeat 7 | ``` 8 | 9 | 3. Checkout the desired version of `elastic/beats` 10 | 11 | ``` 12 | cd $GOPATH/src/github.com/elastic/beats 13 | git checkout 7.x 14 | ``` 15 | 16 | 4. Build 17 | 18 | ``` 19 | cd $GOPATH/src/github.com/PhaedrusTheGreek/nagioscheckbeat 20 | make setup 21 | mage build 22 | go get -u github.com/kardianos/govendor 23 | govendor fetch mgutz/str +out 24 | make release 25 | ``` 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NagiosCheckBeat 2 | 3 | NagiosCheckBeat is the [Beat](https://www.elastic.co/products/beats) used for 4 | running Nagios checks. 5 | 6 | Check out [this blog post](https://www.elastic.co/blog/a-case-for-self-monitoring-systems) on how it works. 7 | 8 | You can integrate with Watcher [(How-To)](https://www.elastic.co/blog/a-case-for-self-monitoring-systems) or Nagios Core [(How-To)](https://discuss.elastic.co/t/questions-about-self-monitoring-systems-blog-post/43542/12?u=phaedrusthegreek) for Alerting. 9 | 10 | ![Kibana Screenshot](https://github.com/PhaedrusTheGreek/nagioscheckbeat/blob/master/ss.png) 11 | 12 | ## Compatibility 13 | 14 | - For Elasticsearch 1.x compatibility, see the 0.5.x branch. 15 | - NagiosCheckBeat 0.6.0 is compatible with Elasticsaerch 2.x through 5.x. 16 | - NagiosCheckbeat 6.2.3 is compatible with Elastic Stack 6.x 17 | - NagiosCheckBeat 7.6.0 is compatible with Elastic Stack 7.x 18 | 19 | ## Security 20 | 21 | - As of NagiosCheckBeat 7.x, process forking must be explicitly allowed by disabling seccomp. Do note the security hazard here! Keep your config secure! 22 | 23 | ``` 24 | seccomp.enabled: false 25 | ``` 26 | 27 | ## Download & Install 28 | 29 | Packages for your OS can be found in [Releases](https://github.com/PhaedrusTheGreek/nagioscheckbeat/releases) 30 | 31 | For example, in an i686 architecture: 32 | 33 | ``` 34 | $ sudo rpm -i https://github.com/PhaedrusTheGreek/nagioscheckbeat/releases/download/6.2.3/nagioscheckbeat-6.2.3-i686.rpm 35 | ``` 36 | 37 | ## Configuration 38 | ``` 39 | ############################# Input ############################################ 40 | input: 41 | checks: 42 | - 43 | name: "heartbeat" 44 | cmd: "/usr/lib64/nagios/plugins/check_dummy" 45 | args: "0 Checking In!" 46 | period: "10s" 47 | - 48 | name: "disks" 49 | cmd: "/usr/lib64/nagios/plugins/check_disk" 50 | args: "-w 80 -c 90 -x /dev" 51 | period: "1h" 52 | - 53 | name: "load" 54 | cmd: "/usr/lib64/nagios/plugins/check_load" 55 | args: "-w 5 -c 10" 56 | period: "1m" 57 | - 58 | name: "io" 59 | cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py" 60 | args: "io_transfer" 61 | period: "30s" 62 | enabled: false 63 | ``` 64 | 65 | ## Produces 66 | 67 | Firstly, the performance data metrics, individually as documents `type: nagiosmetric`: 68 | 69 | ``` 70 | { 71 | "took": 3, 72 | "timed_out": false, 73 | "_shards": { 74 | "total": 5, 75 | "successful": 5, 76 | "skipped": 0, 77 | "failed": 0 78 | }, 79 | "hits": { 80 | "total": 112, 81 | "max_score": 1.6964493, 82 | "hits": [ 83 | { 84 | "_index": "nagioscheckbeat-6.2.2-2018.02.20", 85 | "_type": "doc", 86 | "_id": "-39LtGEBVAhdWhA-GWkB", 87 | "_score": 1.6964493, 88 | "_source": { 89 | "@timestamp": "2018-02-20T17:37:54.953Z", 90 | "value": 638, 91 | "beat": { 92 | "name": "Jasons-MacBook-Pro-912.local", 93 | "hostname": "Jasons-MacBook-Pro-912.local", 94 | "version": "6.2.2" 95 | }, 96 | "uom": "", 97 | "max": 0, 98 | "critical": 0, 99 | "min": 0, 100 | "name": "proc", 101 | "label": "procs", 102 | "warning": 0, 103 | "type": "nagiosmetric" 104 | }, 105 | "fields": { 106 | "name": [ 107 | "proc" 108 | ] 109 | } 110 | }, 111 | { 112 | "_index": "nagioscheckbeat-6.2.2-2018.02.20", 113 | "_type": "doc", 114 | "_id": "O39KtGEBVAhdWhA-o2nY", 115 | "_score": 1.6964493, 116 | "_source": { 117 | "@timestamp": "2018-02-20T17:37:24.949Z", 118 | "name": "load", 119 | "uom": "", 120 | "warning": 5, 121 | "label": "load5", 122 | "critical": 10, 123 | "max": 0, 124 | "type": "nagiosmetric", 125 | "beat": { 126 | "name": "Jasons-MacBook-Pro-912.local", 127 | "hostname": "Jasons-MacBook-Pro-912.local", 128 | "version": "6.2.2" 129 | }, 130 | "value": 0, 131 | "min": 0 132 | }, 133 | "fields": { 134 | "name": [ 135 | "load" 136 | ] 137 | } 138 | } 139 | ] 140 | } 141 | } 142 | ``` 143 | 144 | Secondly, the results of the actual Nagios Checks, where `type: nagioscheck` 145 | 146 | ``` 147 | { 148 | "took": 2, 149 | "timed_out": false, 150 | "_shards": { 151 | "total": 5, 152 | "successful": 5, 153 | "skipped": 0, 154 | "failed": 0 155 | }, 156 | "hits": { 157 | "total": 341, 158 | "max_score": 0.38229805, 159 | "hits": [ 160 | { 161 | "_index": "nagioscheckbeat-6.2.2-2018.02.20", 162 | "_type": "doc", 163 | "_id": "s39KtGEBVAhdWhA-6mkg", 164 | "_score": 0.38229805, 165 | "_source": { 166 | "@timestamp": "2018-02-20T17:37:42.953Z", 167 | "took_ms": 11, 168 | "type": "nagioscheck", 169 | "name": "heartbeat", 170 | "message": "OK: Hello\n", 171 | "beat": { 172 | "name": "Jasons-MacBook-Pro-912.local", 173 | "hostname": "Jasons-MacBook-Pro-912.local", 174 | "version": "6.2.2" 175 | }, 176 | "status": "OK", 177 | "status_code": 0, 178 | "cmd": "/usr/local/sbin/check_dummy", 179 | "args": "0 Hello" 180 | }, 181 | "fields": { 182 | "name": [ 183 | "heartbeat" 184 | ] 185 | } 186 | }, 187 | { 188 | "_index": "nagioscheckbeat-6.2.2-2018.02.20", 189 | "_type": "doc", 190 | "_id": "u39KtGEBVAhdWhA-8Wnv", 191 | "_score": 0.38229805, 192 | "_source": { 193 | "@timestamp": "2018-02-20T17:37:44.952Z", 194 | "cmd": "/usr/local/sbin/check_procs", 195 | "args": "", 196 | "message": "PROCS OK: 638 processes ", 197 | "status_code": 0, 198 | "took_ms": 86, 199 | "beat": { 200 | "name": "Jasons-MacBook-Pro-912.local", 201 | "hostname": "Jasons-MacBook-Pro-912.local", 202 | "version": "6.2.2" 203 | }, 204 | "status": "OK", 205 | "type": "nagioscheck", 206 | "name": "proc" 207 | }, 208 | "fields": { 209 | "name": [ 210 | "proc" 211 | ] 212 | } 213 | }, 214 | { 215 | "_index": "nagioscheckbeat-6.2.2-2018.02.20", 216 | "_type": "doc", 217 | "_id": "9X9LtGEBVAhdWhA-GWkB", 218 | "_score": 0.38229805, 219 | "_source": { 220 | "@timestamp": "2018-02-20T17:37:54.949Z", 221 | "cmd": "/usr/local/sbin/check_load", 222 | "status_code": 0, 223 | "took_ms": 14, 224 | "type": "nagioscheck", 225 | "name": "load", 226 | "args": "-w 5 -c 10", 227 | "message": "OK - load average: 2.19, 0.00, 0.00", 228 | "status": "OK", 229 | "beat": { 230 | "hostname": "Jasons-MacBook-Pro-912.local", 231 | "version": "6.2.2", 232 | "name": "Jasons-MacBook-Pro-912.local" 233 | } 234 | }, 235 | "fields": { 236 | "name": [ 237 | "load" 238 | ] 239 | } 240 | }, 241 | { 242 | "_index": "nagioscheckbeat-6.2.2-2018.02.20", 243 | "_type": "doc", 244 | "_id": "6X9OtGEBVAhdWhA-Jm5P", 245 | "_score": 0.30196804, 246 | "_source": { 247 | "@timestamp": "2018-02-20T17:41:14.956Z", 248 | "name": "disks", 249 | "cmd": "/usr/local/sbin/check_disk", 250 | "message": "DISK CRITICAL - /Users/jason/OBFUSCATED is not accessible: No such file or directory\n", 251 | "beat": { 252 | "name": "Jasons-MacBook-Pro-912.local", 253 | "hostname": "Jasons-MacBook-Pro-912.local", 254 | "version": "6.2.2" 255 | }, 256 | "status": "CRITICAL", 257 | "status_code": 2, 258 | "took_ms": 27, 259 | "type": "nagioscheck", 260 | "args": "-w 80 -c 90" 261 | }, 262 | "fields": { 263 | "name": [ 264 | "disks" 265 | ] 266 | } 267 | } 268 | ] 269 | } 270 | } 271 | ``` 272 | 273 | 274 | 275 | -------------------------------------------------------------------------------- /_meta/beat.docker.yml: -------------------------------------------------------------------------------- 1 | nagioscheckbeat: 2 | period: 1s 3 | -------------------------------------------------------------------------------- /_meta/beat.yml: -------------------------------------------------------------------------------- 1 | ################### Nagioscheckbeat Configuration Example ######################### 2 | 3 | ############################# Nagioscheckbeat ###################################### 4 | 5 | nagioscheckbeat: 6 | checks: 7 | - 8 | name: "heartbeat" 9 | cmd: "/usr/lib64/nagios/plugins/check_dummy" 10 | args: "0 Checking In!" 11 | period: "10s" 12 | -------------------------------------------------------------------------------- /_meta/fields.yml: -------------------------------------------------------------------------------- 1 | - key: nagioscheckbeat 2 | title: "NagiosCheckBeat Performance Metrics" 3 | description: 4 | fields: 5 | - name: name 6 | type: keyword 7 | required: true 8 | description: > 9 | The name of the check that was executed. This will match the check's `name` given in configuration. Each named check might return more than one Performance Metric. 10 | - name: label 11 | type: keyword 12 | required: true 13 | description: > 14 | The Performance Metric Label generated by the Nagios Plugin. For example, this might be the `/dev/hda1` on a disk check. 15 | - name: uom 16 | type: keyword 17 | required: true 18 | description: > 19 | As defined in the [Nagios Performance Data guidelines](https://nagios-plugins.org/doc/guidelines.html), UOM or (Unit Of Measure) indicates the metric's unit type. 20 | - name: value 21 | type: double 22 | required: true 23 | description: > 24 | The Performance Metric Value returned by the Plugin. This is the number that represents the current state of the thing being monitored. 25 | - name: min 26 | type: double 27 | required: false 28 | description: > 29 | The lower boundary of the range that the value is expected to appear in. Handy for drawing graphs. Not required by the plugin if uom=% 30 | - name: max 31 | type: double 32 | required: false 33 | description: > 34 | The upper boundary of the range that the value is expected to appear in. Handy for drawing graphs. Not required by the plugin if uom=% 35 | - name: warning 36 | type: double 37 | required: false 38 | description: > 39 | The warning threshold. Usually specified in the check arguments and regurgitated here. The plugin may not always return WARNING when the value is > this threshold, expecially when multiple performance metrics are being tracked. 40 | - name: critical 41 | type: double 42 | required: false 43 | description: > 44 | The critical threshold. Usually specified in the check arguments and regurgitated here. The plugin may not always return CRITICAL when the value is > this threshold, expecially when multiple performance metrics are being tracked. 45 | 46 | - key: nagioscheckcheck 47 | title: "NagiosCheckBeat Check Results" 48 | description: 49 | fields: 50 | - name: message 51 | type: text 52 | required: true 53 | description: > 54 | The check result message string, as returned from the Nagios plugin. 55 | - name: status 56 | type: keyword 57 | required: true 58 | description: > 59 | The check result's String form status. Will be one of OK, WARNING, CRITICAL, UNKNOWN, or "INVALID STATUS" 60 | - name: status_code 61 | type: integer 62 | required: true 63 | description: > 64 | The check result's Integer form status. Should be 0, 1, 2, or 3, if the Plugin conformed to the standard. 65 | - name: took_ms 66 | type: long 67 | required: true 68 | description: > 69 | How long the plugin took to execute, in Milliseconds, measured by NagiosCheckBeat. 70 | -------------------------------------------------------------------------------- /beater/nagioscheckbeat.go: -------------------------------------------------------------------------------- 1 | package beater 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/elastic/beats/libbeat/beat" 7 | "github.com/elastic/beats/libbeat/common" 8 | "github.com/elastic/beats/libbeat/logp" 9 | 10 | "github.com/PhaedrusTheGreek/nagioscheckbeat/check" 11 | "github.com/PhaedrusTheGreek/nagioscheckbeat/config" 12 | ) 13 | 14 | // Nagioscheckbeat configuration. 15 | type Nagioscheckbeat struct { 16 | done chan struct{} 17 | config config.Config 18 | client beat.Client 19 | } 20 | 21 | // New creates an instance of nagioscheckbeat. 22 | func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) { 23 | c := config.DefaultConfig 24 | if err := cfg.Unpack(&c); err != nil { 25 | return nil, fmt.Errorf("Error reading config file: %v", err) 26 | } 27 | 28 | bt := &Nagioscheckbeat{ 29 | done: make(chan struct{}), 30 | config: c, 31 | } 32 | return bt, nil 33 | } 34 | 35 | // Run starts nagioscheckbeat. 36 | func (bt *Nagioscheckbeat) Run(b *beat.Beat) error { 37 | logp.Info("nagioscheckbeat is running! Hit CTRL-C to stop it.") 38 | 39 | var err error 40 | bt.client, err = b.Publisher.Connect() 41 | if err != nil { 42 | return err 43 | } 44 | 45 | for _, checkConfig := range bt.config.Checks { 46 | 47 | checkInstance := check.NagiosCheck{} 48 | checkInstance.Setup(&checkConfig) 49 | go checkInstance.Run(func(events []beat.Event) { 50 | bt.client.PublishAll(events) 51 | }) 52 | 53 | } 54 | 55 | for { 56 | 57 | select { 58 | case <-bt.done: 59 | return nil 60 | } 61 | } 62 | 63 | return nil 64 | 65 | } 66 | 67 | // Stop stops nagioscheckbeat. 68 | func (bt *Nagioscheckbeat) Stop() { 69 | bt.client.Close() 70 | close(bt.done) 71 | } 72 | -------------------------------------------------------------------------------- /blog/README.md: -------------------------------------------------------------------------------- 1 | ### A case for self monitoring systems 2 | 3 | https://www.elastic.co/blog/a-case-for-self-monitoring-systems 4 | 5 | This is a proof of concept that uses nagioscheckbeat in combination with Elasticsearch, Kibana, and Watcher to implement a total monitoring solution. Tested on CentOS 6. 6 | 7 | ##### Blog Errata 8 | - In *Alerting On Lost Heartbeats* , a *Threshold* parameter is sent to the script, but never used 9 | - A better solution was found later found by [inqueue](https://github.com/inqueue) - Re: Alerting On Lost Heartbeats, instead of using a groovy script for the watch to determine host *downness*, you could do [something like this](https://gist.github.com/inqueue/24b459c177bc0e1967198008eb3a40d4), where we aggregate on heartbeats in the last now-30s seconds. Since the parent query searches for now-1d, we end up with an empty bucket for down hosts. 10 | 11 | ### Requirements 12 | 13 | Requires: 14 | - Docker 15 | 16 | Optional Requirements 17 | - Load Test (hammer.sh) requires redis, mysql, and apache. 18 | 19 | ### Instructions 20 | 21 | 1. Set your gmail username and password in elasticearch/config/elasticsearch.yml (Also see [here](https://support.google.com/accounts/answer/6010255?hl=en), and make sure 2 phase auth is not enabled) 22 | 2. Run Stuff 23 | 24 | ``` 25 | docker-compose build 26 | docker-compose up -d elasticsearch 27 | ./put-template.sh 28 | docker-compose up 29 | ``` 30 | 31 | 3. Navigate to Kibana @ http://docker-server:5601 and configure an index pattern of `nagioscheckbeat*`. Then load the `kibana-dashboard.json` into Objects -> Import. 32 | 33 | 4. run `hammer.sh` to generate something interesting 34 | 35 | -------------------------------------------------------------------------------- /blog/apache/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:latest 2 | 3 | RUN yum -y update && yum clean all 4 | RUN yum -y install curl nc httpd epel-release 5 | RUN yum -y install nagios-plugins-all perl-LWP-Protocol-https.noarch perl-Nagios-Plugin.noarch 6 | RUN yum clean all 7 | RUN rpm -ivh https://github.com/PhaedrusTheGreek/nagioscheckbeat/blob/master/build/nagioscheckbeat-0.5.3-x86_64.rpm?raw=true 8 | 9 | EXPOSE 80 10 | 11 | COPY httpd.conf /etc/httpd/conf/httpd.conf 12 | COPY nagioscheckbeat.yml /etc/nagioscheckbeat/nagioscheckbeat.yml 13 | 14 | COPY check_apachestatus.pl /usr/lib64/nagios/plugins/check_apachestatus.pl 15 | RUN chmod +x /usr/lib64/nagios/plugins/check_apachestatus.pl 16 | 17 | ADD run-stuff.sh /run-stuff.sh 18 | RUN chmod -v +x /run-stuff.sh 19 | 20 | CMD ["/run-stuff.sh"] 21 | -------------------------------------------------------------------------------- /blog/apache/check_apachestatus.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | ####################### check_apachestatus.pl ####################### 3 | # Version : 1.1 4 | # Date : 27 Jul 2007 5 | # Author : De Bodt Lieven (Lieven.DeBodt at gmail.com) 6 | # Licence : GPL - http://www.fsf.org/licenses/gpl.txt 7 | ############################################################# 8 | # 9 | # 20080912 v1.2 10 | # added output of Requests/sec, kB/sec, kB/request 11 | # changed perfdata output so that PNP accepts it 12 | # http://www.behrens.in/download/check_apachestatus.pl.txt 13 | # 14 | # 20080930 v1.3 15 | # Fixed bug in perfdata regexp when Apache output was 16 | # "nnn B/sec" instead of "nnn kB/sec" 17 | # 18 | # 20081231 v1.4 19 | # Made the scale logic more robust to byte only, kilobyte 20 | # and provided capacity for MB and GB scale options 21 | # on bytes per second and bytes per request (untested) 22 | # 23 | # help : ./check_apachestatus.pl -h 24 | 25 | use strict; 26 | use Getopt::Long; 27 | use LWP::UserAgent; 28 | use Time::HiRes qw(gettimeofday tv_interval); 29 | 30 | # Nagios specific 31 | 32 | use lib "/usr/lib64/nagios/plugins"; 33 | use utils qw(%ERRORS $TIMEOUT); 34 | #my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); 35 | 36 | # Globals 37 | 38 | my $Version='1.4'; 39 | my $Name=$0; 40 | 41 | my $o_host = undef; # hostname 42 | my $o_help= undef; # want some help ? 43 | my $o_port = undef; # port 44 | my $o_version= undef; # print version 45 | my $o_warn_level= undef; # Number of available slots that will cause a warning 46 | my $o_crit_level= undef; # Number of available slots that will cause an error 47 | my $o_timeout= 15; # Default 15s Timeout 48 | 49 | # functions 50 | 51 | sub show_versioninfo { print "$Name version : $Version\n"; } 52 | 53 | sub print_usage { 54 | print "Usage: $Name -H [-p ] [-t ] [-w -c ] [-V]\n"; 55 | } 56 | 57 | # Get the alarm signal 58 | $SIG{'ALRM'} = sub { 59 | print ("ERROR: Alarm signal (Nagios time-out)\n"); 60 | exit $ERRORS{"CRITICAL"}; 61 | }; 62 | 63 | sub help { 64 | print "Apache Monitor for Nagios version ",$Version,"\n"; 65 | print "GPL licence, (c)2006-2007 De Bodt Lieven\n\n"; 66 | print_usage(); 67 | print < , 90 | WARNING if we are able to connect to the apache server's status page and #available slots <= , 91 | CRITICAL if we are able to connect to the apache server's status page and #available slots <= , 92 | UNKNOWN if we aren't able to connect to the apache server's status page 93 | 94 | Perfdata legend: 95 | "_;S;R;W;K;D;C;L;G;I;.;1;2;3" 96 | _ : Waiting for Connection 97 | S : Starting up 98 | R : Reading Request 99 | W : Sending Reply 100 | K : Keepalive (read) 101 | D : DNS Lookup 102 | C : Closing connection 103 | L : Logging 104 | G : Gracefully finishing 105 | I : Idle cleanup of worker 106 | . : Open slot with no current process 107 | 1 : Requests per sec 108 | 2 : kB per sec 109 | 3 : kB per Request 110 | 111 | EOT 112 | } 113 | 114 | sub check_options { 115 | Getopt::Long::Configure ("bundling"); 116 | GetOptions( 117 | 'h' => \$o_help, 'help' => \$o_help, 118 | 'H:s' => \$o_host, 'hostname:s' => \$o_host, 119 | 'p:i' => \$o_port, 'port:i' => \$o_port, 120 | 'V' => \$o_version, 'version' => \$o_version, 121 | 'w:i' => \$o_warn_level, 'warn:i' => \$o_warn_level, 122 | 'c:i' => \$o_crit_level, 'critical:i' => \$o_crit_level, 123 | 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, 124 | 125 | ); 126 | 127 | if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; 128 | if (defined($o_version)) { show_versioninfo(); exit $ERRORS{"UNKNOWN"}}; 129 | if (((defined($o_warn_level) && !defined($o_crit_level)) || (!defined($o_warn_level) && defined($o_crit_level))) || ((defined($o_warn_level) && defined($o_crit_level)) && (($o_warn_level != -1) && ($o_warn_level <= $o_crit_level)))) { 130 | print "Check warn and crit!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} 131 | } 132 | # Check compulsory attributes 133 | if (!defined($o_host)) { print_usage(); exit $ERRORS{"UNKNOWN"}}; 134 | } 135 | 136 | ########## MAIN ########## 137 | 138 | check_options(); 139 | 140 | my $ua = LWP::UserAgent->new( protocols_allowed => ['http'], timeout => $o_timeout); 141 | my $timing0 = [gettimeofday]; 142 | my $response = undef; 143 | if (!defined($o_port)) { 144 | $response = $ua->get('http://' . $o_host . '/server-status'); 145 | } else { 146 | $response = $ua->get('http://' . $o_host . ':' . $o_port . '/server-status'); 147 | } 148 | my $timeelapsed = tv_interval ($timing0, [gettimeofday]); 149 | 150 | my $webcontent = undef; 151 | if ($response->is_success) { 152 | $webcontent=$response->content; 153 | my @webcontentarr = split("\n", $webcontent); 154 | my $i = 0; 155 | my $BusyWorkers=undef; 156 | my $IdleWorkers=undef; 157 | # Get the amount of idle and busy workers(Apache2)/servers(Apache1) 158 | while (($i < @webcontentarr) && ((!defined($BusyWorkers)) || (!defined($IdleWorkers)))) { 159 | if ($webcontentarr[$i] =~ /(\d+)\s+requests\s+currently\s+being\s+processed,\s+(\d+)\s+idle\s+....ers/) { 160 | ($BusyWorkers, $IdleWorkers) = ($webcontentarr[$i] =~ /(\d+)\s+requests\s+currently\s+being\s+processed,\s+(\d+)\s+idle\s+....ers/); 161 | } 162 | $i++; 163 | } 164 | 165 | # get requests/sec, kb/sec, kb/req 166 | $i = 0; 167 | my $ReqPerSec=undef; 168 | my $KbPerSec=undef; 169 | my $KbPerReq=undef; 170 | 171 | my $KbRatios = { 172 | g => 1048576, 173 | m => 1024, 174 | k => 1, 175 | empty => 0.0009765625, 176 | }; 177 | 178 | while (($i < @webcontentarr) && ((!defined($ReqPerSec)) || (!defined($KbPerSec)) || (!defined($KbPerReq)))) { 179 | if ($webcontentarr[$i] =~ /([0-9]*\.?[0-9]+)\s+requests\/sec\s+-\s+([0-9]*\.?[0-9]+)\s+(\w)*B\/second\s+-\s+([0-9]*\.?[0-9]+)\s+(\w)*B\/request/) { 180 | my ($Requests, $bPerSec, $sPerSec, $bPerReq, $sPerReq) = ($webcontentarr[$i] =~ /([0-9]*\.?[0-9]+)\s+requests\/sec\s+-\s+([0-9]*\.?[0-9]+)\s+(\w)*B\/second\s+-\s+([0-9]*\.?[0-9]+)\s+(\w)*B\/request/); 181 | $ReqPerSec=$Requests; 182 | if ($sPerSec) { 183 | $KbPerSec = $bPerSec*$KbRatios->{lc($sPerSec)}; 184 | } else { 185 | $KbPerSec = $bPerSec*$KbRatios->{empty}; 186 | } 187 | if ($sPerReq) { 188 | $KbPerReq = $bPerReq*$KbRatios->{lc($sPerReq)}; 189 | } else { 190 | $KbPerReq = $bPerReq*$KbRatios->{empty}; 191 | } 192 | } 193 | $i++; 194 | } 195 | 196 | # Get the scoreboard 197 | my $ScoreBoard = ""; 198 | $i = 0; 199 | my $PosPreBegin = undef; 200 | my $PosPreEnd = undef; 201 | while (($i < @webcontentarr) && ((!defined($PosPreBegin)) || (!defined($PosPreEnd)))) { 202 | if (!defined($PosPreBegin)) { 203 | if ( $webcontentarr[$i] =~ m/
/i ) {
204 |         $PosPreBegin = $i;
205 |       }
206 |     } 
207 |     if (defined($PosPreBegin)) {
208 |       if ( $webcontentarr[$i] =~ m/<\/pre>/i ) {
209 |         $PosPreEnd = $i;
210 |       }
211 |     }
212 |     $i++;
213 |   }
214 |   for ($i = $PosPreBegin; $i <= $PosPreEnd; $i++) {
215 |     $ScoreBoard = $ScoreBoard . $webcontentarr[$i];
216 |   }
217 |   $ScoreBoard =~ s/^.*<[Pp][Rr][Ee]>//;
218 |   $ScoreBoard =~ s/<\/[Pp][Rr][Ee].*>//;
219 | 
220 |   my $CountOpenSlots = ($ScoreBoard =~ tr/\.//);
221 |   if (defined($o_crit_level) && ($o_crit_level != -1)) {
222 |     if (($CountOpenSlots + $IdleWorkers) <= $o_crit_level) {
223 |       printf("CRITICAL %f seconds response time. Idle %d, busy %d, open slots %d | 'Waiting for Connection'=%d 'Starting Up'=%d 'Reading Request'=%d 'Sending Reply'=%d 'Keepalive (read)'=%d 'DNS Lookup'=%d 'Closing Connection'=%d 'Logging'=%d 'Gracefully finishing'=%d 'Idle cleanup'=%d 'Open slot'=%d 'Requests/sec'=%0.1f 'kB per sec'=%0.1fKB 'kB per Request'=%0.1fKB\n", $timeelapsed, $IdleWorkers, $BusyWorkers, $CountOpenSlots, ($ScoreBoard =~ tr/\_//), ($ScoreBoard =~ tr/S//),($ScoreBoard =~ tr/R//),($ScoreBoard =~ tr/W//),($ScoreBoard =~ tr/K//),($ScoreBoard =~ tr/D//),($ScoreBoard =~ tr/C//),($ScoreBoard =~ tr/L//),($ScoreBoard =~ tr/G//),($ScoreBoard =~ tr/I//), $CountOpenSlots, $ReqPerSec, $KbPerSec, $KbPerReq);
224 |       exit $ERRORS{"CRITICAL"}
225 |     }
226 |   } 
227 |   if (defined($o_warn_level) && ($o_warn_level != -1)) {
228 |     if (($CountOpenSlots + $IdleWorkers) <= $o_warn_level) {
229 |       printf("WARNING %f seconds response time. Idle %d, busy %d, open slots %d | 'Waiting for Connection'=%d 'Starting Up'=%d 'Reading Request'=%d 'Sending Reply'=%d 'Keepalive (read)'=%d 'DNS Lookup'=%d 'Closing Connection'=%d 'Logging'=%d 'Gracefully finishing'=%d 'Idle cleanup'=%d 'Open slot'=%d 'Requests/sec'=%0.1f 'kB per sec'=%0.1fKB 'kB per Request'=%0.1fKB\n", $timeelapsed, $IdleWorkers, $BusyWorkers, $CountOpenSlots, ($ScoreBoard =~ tr/\_//), ($ScoreBoard =~ tr/S//),($ScoreBoard =~ tr/R//),($ScoreBoard =~ tr/W//),($ScoreBoard =~ tr/K//),($ScoreBoard =~ tr/D//),($ScoreBoard =~ tr/C//),($ScoreBoard =~ tr/L//),($ScoreBoard =~ tr/G//),($ScoreBoard =~ tr/I//), $CountOpenSlots, $ReqPerSec, $KbPerSec, $KbPerReq);
230 |       exit $ERRORS{"WARNING"}
231 |     }
232 |   }
233 |   printf("OK %f seconds response time. Idle %d, busy %d, open slots %d | 'Waiting for Connection'=%d 'Starting Up'=%d 'Reading Request'=%d 'Sending Reply'=%d 'Keepalive (read)'=%d 'DNS Lookup'=%d 'Closing Connection'=%d 'Logging'=%d 'Gracefully finishing'=%d 'Idle cleanup'=%d 'Open slot'=%d 'Requests/sec'=%0.1f 'kB per sec'=%0.1fKB 'kB per Request'=%0.1fKB\n", $timeelapsed, $IdleWorkers, $BusyWorkers, $CountOpenSlots, ($ScoreBoard =~ tr/\_//), ($ScoreBoard =~ tr/S//),($ScoreBoard =~ tr/R//),($ScoreBoard =~ tr/W//),($ScoreBoard =~ tr/K//),($ScoreBoard =~ tr/D//),($ScoreBoard =~ tr/C//),($ScoreBoard =~ tr/L//),($ScoreBoard =~ tr/G//),($ScoreBoard =~ tr/I//), $CountOpenSlots, $ReqPerSec, $KbPerSec, $KbPerReq);
234 |       exit $ERRORS{"OK"}
235 | }
236 | else {
237 |   if (defined($o_warn_level) || defined($o_crit_level)) {
238 |     printf("UNKNOWN %s\n", $response->status_line);
239 |     exit $ERRORS{"UNKNOWN"}
240 |   } else {
241 |     printf("CRITICAL %s\n", $response->status_line);
242 |     exit $ERRORS{"CRITICAL"}
243 |   }
244 | }
245 | 


--------------------------------------------------------------------------------
/blog/apache/httpd.conf:
--------------------------------------------------------------------------------
  1 | #
  2 | # This is the main Apache HTTP server configuration file.  It contains the
  3 | # configuration directives that give the server its instructions.
  4 | # See  for detailed information.
  5 | # In particular, see 
  6 | # 
  7 | # for a discussion of each configuration directive.
  8 | #
  9 | # Do NOT simply read the instructions in here without understanding
 10 | # what they do.  They're here only as hints or reminders.  If you are unsure
 11 | # consult the online docs. You have been warned.  
 12 | #
 13 | # Configuration and logfile names: If the filenames you specify for many
 14 | # of the server's control files begin with "/" (or "drive:/" for Win32), the
 15 | # server will use that explicit path.  If the filenames do *not* begin
 16 | # with "/", the value of ServerRoot is prepended -- so 'log/access_log'
 17 | # with ServerRoot set to '/www' will be interpreted by the
 18 | # server as '/www/log/access_log', where as '/log/access_log' will be
 19 | # interpreted as '/log/access_log'.
 20 | 
 21 | #
 22 | # ServerRoot: The top of the directory tree under which the server's
 23 | # configuration, error, and log files are kept.
 24 | #
 25 | # Do not add a slash at the end of the directory path.  If you point
 26 | # ServerRoot at a non-local disk, be sure to specify a local disk on the
 27 | # Mutex directive, if file-based mutexes are used.  If you wish to share the
 28 | # same ServerRoot for multiple httpd daemons, you will need to change at
 29 | # least PidFile.
 30 | #
 31 | ServerRoot "/etc/httpd"
 32 | 
 33 | #
 34 | # Listen: Allows you to bind Apache to specific IP addresses and/or
 35 | # ports, instead of the default. See also the 
 36 | # directive.
 37 | #
 38 | # Change this to Listen on specific IP addresses as shown below to 
 39 | # prevent Apache from glomming onto all bound IP addresses.
 40 | #
 41 | #Listen 12.34.56.78:80
 42 | Listen 80
 43 | 
 44 | #
 45 | # Dynamic Shared Object (DSO) Support
 46 | #
 47 | # To be able to use the functionality of a module which was built as a DSO you
 48 | # have to place corresponding `LoadModule' lines at this location so the
 49 | # directives contained in it are actually available _before_ they are used.
 50 | # Statically compiled modules (those listed by `httpd -l') do not need
 51 | # to be loaded here.
 52 | #
 53 | # Example:
 54 | # LoadModule foo_module modules/mod_foo.so
 55 | #
 56 | Include conf.modules.d/*.conf
 57 | 
 58 | #
 59 | # If you wish httpd to run as a different user or group, you must run
 60 | # httpd as root initially and it will switch.  
 61 | #
 62 | # User/Group: The name (or #number) of the user/group to run httpd as.
 63 | # It is usually good practice to create a dedicated user and group for
 64 | # running httpd, as with most system services.
 65 | #
 66 | User apache
 67 | Group apache
 68 | 
 69 | # 'Main' server configuration
 70 | #
 71 | # The directives in this section set up the values used by the 'main'
 72 | # server, which responds to any requests that aren't handled by a
 73 | #  definition.  These values also provide defaults for
 74 | # any  containers you may define later in the file.
 75 | #
 76 | # All of these directives may appear inside  containers,
 77 | # in which case these default settings will be overridden for the
 78 | # virtual host being defined.
 79 | #
 80 | 
 81 | #
 82 | # ServerAdmin: Your address, where problems with the server should be
 83 | # e-mailed.  This address appears on some server-generated pages, such
 84 | # as error documents.  e.g. admin@your-domain.com
 85 | #
 86 | ServerAdmin root@localhost
 87 | 
 88 | #
 89 | # ServerName gives the name and port that the server uses to identify itself.
 90 | # This can often be determined automatically, but we recommend you specify
 91 | # it explicitly to prevent problems during startup.
 92 | #
 93 | # If your host doesn't have a registered DNS name, enter its IP address here.
 94 | #
 95 | #ServerName www.example.com:80
 96 | 
 97 | #
 98 | # Deny access to the entirety of your server's filesystem. You must
 99 | # explicitly permit access to web content directories in other 
100 | #  blocks below.
101 | #
102 | 
103 |     AllowOverride none
104 |     Require all denied
105 | 
106 | 
107 | #
108 | # Note that from this point forward you must specifically allow
109 | # particular features to be enabled - so if something's not working as
110 | # you might expect, make sure that you have specifically enabled it
111 | # below.
112 | #
113 | 
114 | #
115 | # DocumentRoot: The directory out of which you will serve your
116 | # documents. By default, all requests are taken from this directory, but
117 | # symbolic links and aliases may be used to point to other locations.
118 | #
119 | DocumentRoot "/var/www/html"
120 | 
121 | #
122 | # Relax access to content within /var/www.
123 | #
124 | 
125 |     AllowOverride None
126 |     # Allow open access:
127 |     Require all granted
128 | 
129 | 
130 | # Further relax access to the default document root:
131 | 
132 |     #
133 |     # Possible values for the Options directive are "None", "All",
134 |     # or any combination of:
135 |     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
136 |     #
137 |     # Note that "MultiViews" must be named *explicitly* --- "Options All"
138 |     # doesn't give it to you.
139 |     #
140 |     # The Options directive is both complicated and important.  Please see
141 |     # http://httpd.apache.org/docs/2.4/mod/core.html#options
142 |     # for more information.
143 |     #
144 |     Options Indexes FollowSymLinks
145 | 
146 |     #
147 |     # AllowOverride controls what directives may be placed in .htaccess files.
148 |     # It can be "All", "None", or any combination of the keywords:
149 |     #   Options FileInfo AuthConfig Limit
150 |     #
151 |     AllowOverride None
152 | 
153 |     #
154 |     # Controls who can get stuff from this server.
155 |     #
156 |     Require all granted
157 | 
158 | 
159 | #
160 | # DirectoryIndex: sets the file that Apache will serve if a directory
161 | # is requested.
162 | #
163 | 
164 |     DirectoryIndex index.html
165 | 
166 | 
167 | #
168 | # The following lines prevent .htaccess and .htpasswd files from being 
169 | # viewed by Web clients. 
170 | #
171 | 
172 |     Require all denied
173 | 
174 | 
175 | #
176 | # ErrorLog: The location of the error log file.
177 | # If you do not specify an ErrorLog directive within a 
178 | # container, error messages relating to that virtual host will be
179 | # logged here.  If you *do* define an error logfile for a 
180 | # container, that host's errors will be logged there and not here.
181 | #
182 | ErrorLog "logs/error_log"
183 | 
184 | #
185 | # LogLevel: Control the number of messages logged to the error_log.
186 | # Possible values include: debug, info, notice, warn, error, crit,
187 | # alert, emerg.
188 | #
189 | LogLevel warn
190 | 
191 | 
192 |     #
193 |     # The following directives define some format nicknames for use with
194 |     # a CustomLog directive (see below).
195 |     #
196 |     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
197 |     LogFormat "%h %l %u %t \"%r\" %>s %b" common
198 | 
199 |     
200 |       # You need to enable mod_logio.c to use %I and %O
201 |       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
202 |     
203 | 
204 |     #
205 |     # The location and format of the access logfile (Common Logfile Format).
206 |     # If you do not define any access logfiles within a 
207 |     # container, they will be logged here.  Contrariwise, if you *do*
208 |     # define per- access logfiles, transactions will be
209 |     # logged therein and *not* in this file.
210 |     #
211 |     #CustomLog "logs/access_log" common
212 | 
213 |     #
214 |     # If you prefer a logfile with access, agent, and referer information
215 |     # (Combined Logfile Format) you can use the following directive.
216 |     #
217 |     CustomLog "logs/access_log" combined
218 | 
219 | 
220 | 
221 |     #
222 |     # Redirect: Allows you to tell clients about documents that used to 
223 |     # exist in your server's namespace, but do not anymore. The client 
224 |     # will make a new request for the document at its new location.
225 |     # Example:
226 |     # Redirect permanent /foo http://www.example.com/bar
227 | 
228 |     #
229 |     # Alias: Maps web paths into filesystem paths and is used to
230 |     # access content that does not live under the DocumentRoot.
231 |     # Example:
232 |     # Alias /webpath /full/filesystem/path
233 |     #
234 |     # If you include a trailing / on /webpath then the server will
235 |     # require it to be present in the URL.  You will also likely
236 |     # need to provide a  section to allow access to
237 |     # the filesystem path.
238 | 
239 |     #
240 |     # ScriptAlias: This controls which directories contain server scripts. 
241 |     # ScriptAliases are essentially the same as Aliases, except that
242 |     # documents in the target directory are treated as applications and
243 |     # run by the server when requested rather than as documents sent to the
244 |     # client.  The same rules about trailing "/" apply to ScriptAlias
245 |     # directives as to Alias.
246 |     #
247 |     ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
248 | 
249 | 
250 | 
251 | #
252 | # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
253 | # CGI directory exists, if you have that configured.
254 | #
255 | 
256 |     AllowOverride None
257 |     Options None
258 |     Require all granted
259 | 
260 | 
261 | 
262 |     #
263 |     # TypesConfig points to the file containing the list of mappings from
264 |     # filename extension to MIME-type.
265 |     #
266 |     TypesConfig /etc/mime.types
267 | 
268 |     #
269 |     # AddType allows you to add to or override the MIME configuration
270 |     # file specified in TypesConfig for specific file types.
271 |     #
272 |     #AddType application/x-gzip .tgz
273 |     #
274 |     # AddEncoding allows you to have certain browsers uncompress
275 |     # information on the fly. Note: Not all browsers support this.
276 |     #
277 |     #AddEncoding x-compress .Z
278 |     #AddEncoding x-gzip .gz .tgz
279 |     #
280 |     # If the AddEncoding directives above are commented-out, then you
281 |     # probably should define those extensions to indicate media types:
282 |     #
283 |     AddType application/x-compress .Z
284 |     AddType application/x-gzip .gz .tgz
285 | 
286 |     #
287 |     # AddHandler allows you to map certain file extensions to "handlers":
288 |     # actions unrelated to filetype. These can be either built into the server
289 |     # or added with the Action directive (see below)
290 |     #
291 |     # To use CGI scripts outside of ScriptAliased directories:
292 |     # (You will also need to add "ExecCGI" to the "Options" directive.)
293 |     #
294 |     #AddHandler cgi-script .cgi
295 | 
296 |     # For type maps (negotiated resources):
297 |     #AddHandler type-map var
298 | 
299 |     #
300 |     # Filters allow you to process content before it is sent to the client.
301 |     #
302 |     # To parse .shtml files for server-side includes (SSI):
303 |     # (You will also need to add "Includes" to the "Options" directive.)
304 |     #
305 |     AddType text/html .shtml
306 |     AddOutputFilter INCLUDES .shtml
307 | 
308 | 
309 | #
310 | # Specify a default charset for all content served; this enables
311 | # interpretation of all content as UTF-8 by default.  To use the 
312 | # default browser choice (ISO-8859-1), or to allow the META tags
313 | # in HTML content to override this choice, comment out this
314 | # directive:
315 | #
316 | AddDefaultCharset UTF-8
317 | 
318 | 
319 |     #
320 |     # The mod_mime_magic module allows the server to use various hints from the
321 |     # contents of the file itself to determine its type.  The MIMEMagicFile
322 |     # directive tells the module where the hint definitions are located.
323 |     #
324 |     MIMEMagicFile conf/magic
325 | 
326 | 
327 | #
328 | # Customizable error responses come in three flavors:
329 | # 1) plain text 2) local redirects 3) external redirects
330 | #
331 | # Some examples:
332 | #ErrorDocument 500 "The server made a boo boo."
333 | #ErrorDocument 404 /missing.html
334 | #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
335 | #ErrorDocument 402 http://www.example.com/subscription_info.html
336 | #
337 | 
338 | #
339 | # EnableMMAP and EnableSendfile: On systems that support it, 
340 | # memory-mapping or the sendfile syscall may be used to deliver
341 | # files.  This usually improves server performance, but must
342 | # be turned off when serving from networked-mounted 
343 | # filesystems or if support for these functions is otherwise
344 | # broken on your system.
345 | # Defaults if commented: EnableMMAP On, EnableSendfile Off
346 | #
347 | #EnableMMAP off
348 | EnableSendfile on
349 | 
350 | # Supplemental configuration
351 | #
352 | # Load config files in the "/etc/httpd/conf.d" directory, if any.
353 | IncludeOptional conf.d/*.conf
354 | 
355 | ExtendedStatus On
356 | 
357 | SetHandler server-status
358 | Order Deny,Allow
359 | Deny from all
360 | Allow from all
361 | 
362 | 


--------------------------------------------------------------------------------
/blog/apache/nagioscheckbeat.yml:
--------------------------------------------------------------------------------
  1 | ################### NagiosCheckBeat Configuration Example #########################
  2 | 
  3 | ############################# Input ############################################
  4 | input:
  5 |   checks:
  6 |     -
  7 |       name: "heartbeat"
  8 |       cmd: "/usr/lib64/nagios/plugins/check_dummy"
  9 |       args: "0 Hello"
 10 |       period: "10s"
 11 |     -
 12 |       period: "10s"
 13 |       name: "apache"
 14 |       cmd: "/usr/lib64/nagios/plugins/check_apachestatus.pl"
 15 |       args: "-H localhost"
 16 | 
 17 | ###############################################################################
 18 | ############################# Libbeat Config ##################################
 19 | # Base config file used by all other beats for using libbeat features
 20 | 
 21 | ############################# Output ##########################################
 22 | 
 23 | # Configure what outputs to use when sending the data collected by the beat.
 24 | # Multiple outputs may be used.
 25 | output:
 26 | 
 27 |   ### Elasticsearch as output
 28 |   elasticsearch:
 29 |     # Array of hosts to connect to.
 30 |     # Scheme and port can be left out and will be set to the default (http and 9200)
 31 |     # In case you specify and additional path, the scheme is required: http://localhost:9200/path
 32 |     # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
 33 |     hosts: ["elasticsearch:9200"]
 34 | 
 35 |     # Optional protocol and basic auth credentials. These are deprecated.
 36 |     #protocol: "https"
 37 |     #username: "admin"
 38 |     #password: "s3cr3t"
 39 | 
 40 |     # Number of workers per Elasticsearch host.
 41 |     #worker: 1
 42 | 
 43 |     # Optional index name. The default is "nagioscheckbeat" and generates
 44 |     # [nagioscheckbeat-]YYYY.MM.DD keys.
 45 |     #index: "nagioscheckbeat"
 46 | 
 47 |     # Optional HTTP Path
 48 |     #path: "/elasticsearch"
 49 | 
 50 |     # The number of times a particular Elasticsearch index operation is attempted. If
 51 |     # the indexing operation doesn't succeed after this many retries, the events are
 52 |     # dropped. The default is 3.
 53 |     #max_retries: 3
 54 | 
 55 |     # The maximum number of events to bulk in a single Elasticsearch bulk API index request.
 56 |     # The default is 50.
 57 |     #bulk_max_size: 50
 58 | 
 59 |     # Configure http request timeout before failing an request to Elasticsearch.
 60 |     #timeout: 90
 61 | 
 62 |     # The number of seconds to wait for new events between two bulk API index requests.
 63 |     # If `bulk_max_size` is reached before this interval expires, addition bulk index
 64 |     # requests are made.
 65 |     #flush_interval: 1
 66 | 
 67 |     # Boolean that sets if the topology is kept in Elasticsearch. The default is
 68 |     # false. This option makes sense only for Packetbeat.
 69 |     #save_topology: false
 70 | 
 71 |     # The time to live in seconds for the topology information that is stored in
 72 |     # Elasticsearch. The default is 15 seconds.
 73 |     #topology_expire: 15
 74 | 
 75 |     # tls configuration. By default is off.
 76 |     #tls:
 77 |       # List of root certificates for HTTPS server verifications
 78 |       #certificate_authorities: ["/etc/pki/root/ca.pem"]
 79 | 
 80 |       # Certificate for TLS client authentication
 81 |       #certificate: "/etc/pki/client/cert.pem"
 82 | 
 83 |       # Client Certificate Key
 84 |       #certificate_key: "/etc/pki/client/cert.key"
 85 | 
 86 |       # Controls whether the client verifies server certificates and host name.
 87 |       # If insecure is set to true, all server host names and certificates will be
 88 |       # accepted. In this mode TLS based connections are susceptible to
 89 |       # man-in-the-middle attacks. Use only for testing.
 90 |       #insecure: true
 91 | 
 92 |       # Configure cipher suites to be used for TLS connections
 93 |       #cipher_suites: []
 94 | 
 95 |       # Configure curve types for ECDHE based cipher suites
 96 |       #curve_types: []
 97 | 
 98 |       # Configure minimum TLS version allowed for connection to logstash
 99 |       #min_version: 1.0
100 | 
101 |       # Configure maximum TLS version allowed for connection to logstash
102 |       #max_version: 1.2
103 | 
104 | 
105 |   ### Logstash as output
106 |   #logstash:
107 |     # The Logstash hosts
108 |     #hosts: ["localhost:5044"]
109 | 
110 |     # Number of workers per Logstash host.
111 |     #worker: 1
112 | 
113 |     # Optional load balance the events between the Logstash hosts
114 |     #loadbalance: true
115 | 
116 |     # Optional index name. The default index name depends on the each beat.
117 |     # For Packetbeat, the default is set to packetbeat, for Topbeat
118 |     # to topbeat and for Filebeat to filebeat.
119 |     #index: nagioscheckbeat
120 | 
121 |     # Optional TLS. By default is off.
122 |     #tls:
123 |       # List of root certificates for HTTPS server verifications
124 |       #certificate_authorities: ["/etc/pki/root/ca.pem"]
125 | 
126 |       # Certificate for TLS client authentication
127 |       #certificate: "/etc/pki/client/cert.pem"
128 | 
129 |       # Client Certificate Key
130 |       #certificate_key: "/etc/pki/client/cert.key"
131 | 
132 |       # Controls whether the client verifies server certificates and host name.
133 |       # If insecure is set to true, all server host names and certificates will be
134 |       # accepted. In this mode TLS based connections are susceptible to
135 |       # man-in-the-middle attacks. Use only for testing.
136 |       #insecure: true
137 | 
138 |       # Configure cipher suites to be used for TLS connections
139 |       #cipher_suites: []
140 | 
141 |       # Configure curve types for ECDHE based cipher suites
142 |       #curve_types: []
143 | 
144 | 
145 |   ### File as output
146 |   #file:
147 |     # Path to the directory where to save the generated files. The option is mandatory.
148 |     #path: "/tmp/nagioscheckbeat"
149 | 
150 |     # Name of the generated files. The default is `nagioscheckbeat` and it generates files: `nagioscheckbeat`, `nagioscheckbeat.1`, `nagioscheckbeat.2`, etc.
151 |     #filename: nagioscheckbeat
152 | 
153 |     # Maximum size in kilobytes of each file. When this size is reached, the files are
154 |     # rotated. The default value is 10 MB.
155 |     #rotate_every_kb: 10000
156 | 
157 |     # Maximum number of files under path. When this number of files is reached, the
158 |     # oldest file is deleted and the rest are shifted from last to first. The default
159 |     # is 7 files.
160 |     #number_of_files: 7
161 | 
162 | 
163 |   ### Console output
164 |   # console:
165 |     # Pretty print json event
166 |     #pretty: false
167 | 
168 | 
169 | ############################# Shipper #########################################
170 | 
171 | shipper:
172 |   # The name of the shipper that publishes the network data. It can be used to group
173 |   # all the transactions sent by a single shipper in the web interface.
174 |   # If this options is not defined, the hostname is used.
175 |   #name:
176 | 
177 |   # The tags of the shipper are included in their own field with each
178 |   # transaction published. Tags make it easy to group servers by different
179 |   # logical properties.
180 |   #tags: ["service-X", "web-tier"]
181 | 
182 |   # Uncomment the following if you want to ignore transactions created
183 |   # by the server on which the shipper is installed. This option is useful
184 |   # to remove duplicates if shippers are installed on multiple servers.
185 |   #ignore_outgoing: true
186 | 
187 |   # How often (in seconds) shippers are publishing their IPs to the topology map.
188 |   # The default is 10 seconds.
189 |   #refresh_topology_freq: 10
190 | 
191 |   # Expiration time (in seconds) of the IPs published by a shipper to the topology map.
192 |   # All the IPs will be deleted afterwards. Note, that the value must be higher than
193 |   # refresh_topology_freq. The default is 15 seconds.
194 |   #topology_expire: 15
195 | 
196 |   # Configure local GeoIP database support.
197 |   # If no paths are not configured geoip is disabled.
198 |   #geoip:
199 |     #paths:
200 |     #  - "/usr/share/GeoIP/GeoLiteCity.dat"
201 |     #  - "/usr/local/var/GeoIP/GeoLiteCity.dat"
202 | 
203 | 
204 | ############################# Logging #########################################
205 | 
206 | # There are three options for the log ouput: syslog, file, stderr.
207 | # Under Windos systems, the log files are per default sent to the file output,
208 | # under all other system per default to syslog.
209 | logging:
210 | 
211 |   # Send all logging output to syslog. On Windows default is false, otherwise
212 |   # default is true.
213 |   #to_syslog: true
214 | 
215 |   # Write all logging output to files. Beats automatically rotate files if rotateeverybytes
216 |   # limit is reached.
217 |   to_files: true
218 | 
219 |   # To enable logging to files, to_files option has to be set to true
220 |   files:
221 |     # The directory where the log files will written to.
222 |     path: /var/log/nagioscheck
223 | 
224 |     # The name of the files where the logs are written to.
225 |     name: beat
226 | 
227 |     # Configure log file size limit. If limit is reached, log file will be
228 |     # automatically rotated
229 |     rotateeverybytes: 10485760 # = 10MB
230 | 
231 |     # Number of rotated log files to keep. Oldest files will be deleted first.
232 |     #keepfiles: 7
233 | 
234 |   # Enable debug output for selected components. To enable all selectors use ["*"]
235 |   # Other available selectors are beat, publish, service
236 |   # Multiple selectors can be chained.
237 |   selectors: ["*"]
238 | 
239 |   # Sets log level. The default log level is error.
240 |   # Available log levels are: critical, error, warning, info, debug
241 |   level: debug
242 | 
243 | 
244 | 


--------------------------------------------------------------------------------
/blog/apache/run-stuff.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/bash
 2 | 
 3 | # Make sure we're not confused by old, incompletely-shutdown httpd
 4 | # context after restarting the container.  httpd won't start correctly
 5 | # if it thinks it is already running.
 6 | rm -rf /run/httpd/* /tmp/httpd*
 7 | 
 8 | /usr/bin/nagioscheckbeat -c /etc/nagioscheckbeat/nagioscheckbeat.yml &
 9 | 
10 | exec /usr/sbin/apachectl -DFOREGROUND
11 | 


--------------------------------------------------------------------------------
/blog/docker-compose.yml:
--------------------------------------------------------------------------------
 1 | elasticsearch:
 2 |   build: elasticsearch/
 3 |   command: elasticsearch -Des.default.path.conf=/etc/elasticsearch
 4 |   volumes:
 5 |     - ./elasticsearch/config/:/etc/elasticsearch/
 6 |   ports:
 7 |     - "9200:9200"
 8 | kibana:
 9 |   build: kibana/
10 |   hostname: kibana1
11 |   volumes:
12 |     - ./kibana/config/kibana.yml:/opt/kibana/config/kibana.yml
13 |   ports:
14 |     - "5601:5601"
15 |   links:
16 |     - "elasticsearch:elasticsearch"
17 | mysql:
18 |   build: mysql
19 |   hostname: mysql1
20 |   ports:
21 |     - "3306:3306"
22 |   links:
23 |     - "elasticsearch:elasticsearch"
24 |   environment:
25 |     MYSQL_DATABASE: mysqlslap
26 | redis:
27 |   build: redis
28 |   hostname: redis1
29 |   links:
30 |     - "elasticsearch:elasticsearch"
31 |   ports:
32 |     - "6379:6379"
33 | web:
34 |   hostname: web1
35 |   links:
36 |     - "elasticsearch:elasticsearch"
37 |   restart: always
38 |   build: apache
39 |   ports:
40 |     - "80:80"
41 | 


--------------------------------------------------------------------------------
/blog/elasticsearch/Dockerfile:
--------------------------------------------------------------------------------
 1 | FROM elasticsearch:latest
 2 | 
 3 | ENV ES_HEAP_SIZE 4G
 4 | 
 5 | EXPOSE 9200
 6 | 
 7 | RUN /usr/share/elasticsearch/bin/plugin install license
 8 | RUN /usr/share/elasticsearch/bin/plugin install watcher
 9 | 
10 | ENTRYPOINT ["/docker-entrypoint.sh"]
11 | 


--------------------------------------------------------------------------------
/blog/elasticsearch/config/elasticsearch.yml:
--------------------------------------------------------------------------------
 1 | network.host: 0.0.0.0
 2 | 
 3 | watcher.actions.email.service.account:
 4 |   work:
 5 |     profile: gmail
 6 |     smtp:
 7 |       auth: true
 8 |       starttls.enable: true
 9 |       host: smtp.gmail.com
10 |       port: 587
11 |       user: you@gmail.com
12 |       password: blah
13 | 


--------------------------------------------------------------------------------
/blog/elasticsearch/config/logging.yml:
--------------------------------------------------------------------------------
 1 | # you can override this using by setting a system property, for example -Des.logger.level=DEBUG
 2 | es.logger.level: INFO
 3 | rootLogger: ${es.logger.level}, console, file
 4 | logger:
 5 |   # log action execution errors for easier debugging
 6 |   action: DEBUG
 7 | 
 8 |   # deprecation logging, turn to DEBUG to see them
 9 |   deprecation: INFO, deprecation_log_file
10 | 
11 |   # reduce the logging for aws, too much is logged under the default INFO
12 |   com.amazonaws: WARN
13 |   # aws will try to do some sketchy JMX stuff, but its not needed.
14 |   com.amazonaws.jmx.SdkMBeanRegistrySupport: ERROR
15 |   com.amazonaws.metrics.AwsSdkMetrics: ERROR
16 | 
17 |   org.apache.http: INFO
18 | 
19 |   # gateway
20 |   #gateway: DEBUG
21 |   #index.gateway: DEBUG
22 | 
23 |   # peer shard recovery
24 |   #indices.recovery: DEBUG
25 | 
26 |   # discovery
27 |   #discovery: TRACE
28 | 
29 |   index.search.slowlog: TRACE, index_search_slow_log_file
30 |   index.indexing.slowlog: TRACE, index_indexing_slow_log_file
31 | 
32 | additivity:
33 |   index.search.slowlog: false
34 |   index.indexing.slowlog: false
35 |   deprecation: false
36 | 
37 | appender:
38 |   console:
39 |     type: console
40 |     layout:
41 |       type: consolePattern
42 |       conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
43 | 
44 |   file:
45 |     type: dailyRollingFile
46 |     file: ${path.logs}/${cluster.name}.log
47 |     datePattern: "'.'yyyy-MM-dd"
48 |     layout:
49 |       type: pattern
50 |       conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %.10000m%n"
51 | 
52 |   # Use the following log4j-extras RollingFileAppender to enable gzip compression of log files. 
53 |   # For more information see https://logging.apache.org/log4j/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html
54 |   #file:
55 |     #type: extrasRollingFile
56 |     #file: ${path.logs}/${cluster.name}.log
57 |     #rollingPolicy: timeBased
58 |     #rollingPolicy.FileNamePattern: ${path.logs}/${cluster.name}.log.%d{yyyy-MM-dd}.gz
59 |     #layout:
60 |       #type: pattern
61 |       #conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
62 | 
63 |   deprecation_log_file:
64 |     type: dailyRollingFile
65 |     file: ${path.logs}/${cluster.name}_deprecation.log
66 |     datePattern: "'.'yyyy-MM-dd"
67 |     layout:
68 |       type: pattern
69 |       conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
70 | 
71 |   index_search_slow_log_file:
72 |     type: dailyRollingFile
73 |     file: ${path.logs}/${cluster.name}_index_search_slowlog.log
74 |     datePattern: "'.'yyyy-MM-dd"
75 |     layout:
76 |       type: pattern
77 |       conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
78 | 
79 |   index_indexing_slow_log_file:
80 |     type: dailyRollingFile
81 |     file: ${path.logs}/${cluster.name}_index_indexing_slowlog.log
82 |     datePattern: "'.'yyyy-MM-dd"
83 |     layout:
84 |       type: pattern
85 |       conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
86 | 


--------------------------------------------------------------------------------
/blog/elasticsearch/config/scripts/monitor-hosts.groovy:
--------------------------------------------------------------------------------
 1 | def minutes = 5
 2 | def now = DateTime.now().getMillis()
 3 | ctx.vars.hosts = [ up: [], down: [] ]
 4 | ctx.payload.aggregations.hosts.buckets.each {
 5 |  def last_heartbeat = it.latest_heartbeat.hits.hits[0].sort[0];
 6 |  def ms_ago = now - last_heartbeat
 7 |  if (ms_ago > (minutes * 1000) ){
 8 |    ctx.vars.hosts.down.add( [ hostname: it.key, last_heartbeat: new Date(last_heartbeat) ])
 9 |  } 
10 | }
11 | return ctx.vars.hosts.down.size() > 0
12 | 


--------------------------------------------------------------------------------
/blog/hammer.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/bash
 2 | 
 3 | # Requires mysql
 4 | docker exec blog_mysql_1 mysql -e"create database mysqlslap"
 5 | mysqlslap -v -h127.0.0.1  –auto-generate-sql --iterations=100 -concurrency=200 --auto-generate-sql --verbose >> /tmp/hammer.log 2>&1 &
 6 | 
 7 | # Requires apache
 8 | ab -n 100000 -c 200 http://localhost/ >> /tmp/hammer.log 2>&1 &
 9 | 
10 | # Requires redis
11 | redis-benchmark -c 200 -n 1000000 >> /tmp/hammer.log 2>&1 &
12 | 
13 | read -p "Hammering... [Enter] key to stop...  (See log in /tmp/hammer.log)"
14 | 
15 | killall redis-benchmark
16 | killall ab
17 | killall mysqlslap
18 | 


--------------------------------------------------------------------------------
/blog/kibana-dashboard.json:
--------------------------------------------------------------------------------
 1 | [
 2 |   {
 3 |     "_id": "Overview",
 4 |     "_type": "dashboard",
 5 |     "_source": {
 6 |       "title": "Overview",
 7 |       "hits": 0,
 8 |       "description": "",
 9 |       "panelsJSON": "[{\"id\":\"MySQL-Performance\",\"type\":\"visualization\",\"panelIndex\":1,\"size_x\":12,\"size_y\":4,\"col\":1,\"row\":4},{\"id\":\"Apache-Workers\",\"type\":\"visualization\",\"panelIndex\":2,\"size_x\":6,\"size_y\":3,\"col\":1,\"row\":1},{\"id\":\"Apache-Traffic\",\"type\":\"visualization\",\"panelIndex\":3,\"size_x\":6,\"size_y\":3,\"col\":7,\"row\":1}]",
10 |       "optionsJSON": "{\"darkTheme\":false}",
11 |       "uiStateJSON": "{}",
12 |       "version": 1,
13 |       "timeRestore": false,
14 |       "kibanaSavedObjectMeta": {
15 |         "searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}]}"
16 |       }
17 |     }
18 |   },
19 |   {
20 |     "_id": "MySQL-Performance",
21 |     "_type": "visualization",
22 |     "_source": {
23 |       "title": "MySQL Performance",
24 |       "visState": "{\"type\":\"line\",\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"defaultYExtents\":false,\"drawLinesBetweenPoints\":true,\"interpolate\":\"linear\",\"radiusRatio\":9,\"scale\":\"linear\",\"setYExtents\":false,\"shareYAxis\":true,\"showCircles\":false,\"smoothLines\":true,\"times\":[],\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"value\"}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"label\",\"size\":50,\"order\":\"desc\",\"orderBy\":\"1\"}}],\"listeners\":{}}",
25 |       "uiStateJSON": "{}",
26 |       "description": "",
27 |       "version": 1,
28 |       "kibanaSavedObjectMeta": {
29 |         "searchSourceJSON": "{\"index\":\"nagioscheckbeat*\",\"query\":{\"query_string\":{\"query\":\"name:mysql* && (label:selects_per_sec || label:index_usage_now || label:qcache_hitrate_now || label:slow_queries_rate || label:threads_running)\",\"analyze_wildcard\":true}},\"filter\":[]}"
30 |       }
31 |     }
32 |   },
33 |   {
34 |     "_id": "MySQL-Line-Graph",
35 |     "_type": "visualization",
36 |     "_source": {
37 |       "title": "MySQL Line Graph",
38 |       "visState": "{\"type\":\"line\",\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"defaultYExtents\":false,\"drawLinesBetweenPoints\":true,\"interpolate\":\"linear\",\"radiusRatio\":9,\"scale\":\"linear\",\"setYExtents\":false,\"shareYAxis\":true,\"showCircles\":false,\"smoothLines\":true,\"times\":[],\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"value\"}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"label\",\"size\":50,\"order\":\"desc\",\"orderBy\":\"1\"}}],\"listeners\":{}}",
39 |       "uiStateJSON": "{}",
40 |       "description": "",
41 |       "version": 1,
42 |       "kibanaSavedObjectMeta": {
43 |         "searchSourceJSON": "{\"index\":\"nagioscheckbeat*\",\"query\":{\"query_string\":{\"query\":\"name:mysql* && (label:selects_per_sec || label:index_usage || label:qcache_hitrate || label:slow_queries_rate || label:threads_running)\",\"analyze_wildcard\":true}},\"filter\":[]}"
44 |       }
45 |     }
46 |   },
47 |   {
48 |     "_id": "Apache-Workers",
49 |     "_type": "visualization",
50 |     "_source": {
51 |       "title": "Apache Workers",
52 |       "visState": "{\"aggs\":[{\"id\":\"1\",\"params\":{\"field\":\"value\"},\"schema\":\"metric\",\"type\":\"avg\"},{\"id\":\"2\",\"params\":{\"customInterval\":\"2h\",\"extended_bounds\":{},\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1},\"schema\":\"segment\",\"type\":\"date_histogram\"},{\"id\":\"3\",\"params\":{\"field\":\"label\",\"order\":\"desc\",\"orderBy\":\"1\",\"size\":10},\"schema\":\"group\",\"type\":\"terms\"}],\"listeners\":{},\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"defaultYExtents\":false,\"mode\":\"percentage\",\"scale\":\"linear\",\"setYExtents\":false,\"shareYAxis\":true,\"times\":[],\"yAxis\":{}},\"type\":\"histogram\"}",
53 |       "uiStateJSON": "{}",
54 |       "description": "",
55 |       "version": 1,
56 |       "kibanaSavedObjectMeta": {
57 |         "searchSourceJSON": "{\"index\":\"nagioscheckbeat*\",\"query\":{\"query_string\":{\"query\":\"name:apache* && ( label:\\\"Open slot\\\" OR label:\\\"Waiting for Connection\\\" OR label:\\\"Sending Reply\\\" OR label:\\\"Closing Connection\\\" OR  label:\\\"DNS Lookup\\\" OR label:\\\"Gracefully finishing\\\" OR label:\\\"Idle Cleanup\\\")\",\"analyze_wildcard\":true}},\"filter\":[]}"
58 |       }
59 |     }
60 |   },
61 |   {
62 |     "_id": "Apache-Traffic",
63 |     "_type": "visualization",
64 |     "_source": {
65 |       "title": "Apache Traffic",
66 |       "visState": "{\"type\":\"area\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"smoothLines\":true,\"scale\":\"linear\",\"interpolate\":\"linear\",\"mode\":\"overlap\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"value\"}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"label\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\"}}],\"listeners\":{}}",
67 |       "uiStateJSON": "{}",
68 |       "description": "",
69 |       "version": 1,
70 |       "kibanaSavedObjectMeta": {
71 |         "searchSourceJSON": "{\"index\":\"nagioscheckbeat*\",\"query\":{\"query_string\":{\"query\":\"name:apache*  && ( label:\\\"kB per sec\\\" OR label:\\\"Requests/sec\\\")\",\"analyze_wildcard\":true}},\"filter\":[]}"
72 |       }
73 |     }
74 |   },
75 |   {
76 |     "_id": "Critical-Services",
77 |     "_type": "visualization",
78 |     "_source": {
79 |       "title": "Critical Services",
80 |       "visState": "{\"type\":\"histogram\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"scale\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"name\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\"}},{\"id\":\"4\",\"type\":\"terms\",\"schema\":\"split\",\"params\":{\"field\":\"beat.hostname\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"row\":true}}],\"listeners\":{}}",
81 |       "uiStateJSON": "{}",
82 |       "description": "",
83 |       "version": 1,
84 |       "kibanaSavedObjectMeta": {
85 |         "searchSourceJSON": "{\"index\":\"nagioscheckbeat*\",\"query\":{\"query_string\":{\"query\":\"type:nagioscheck AND status:CRITICAL\",\"analyze_wildcard\":true}},\"filter\":[]}"
86 |       }
87 |     }
88 |   }
89 | ]


--------------------------------------------------------------------------------
/blog/kibana/Dockerfile:
--------------------------------------------------------------------------------
 1 | FROM kibana:latest
 2 | 
 3 | RUN apt-get update && apt-get install -y netcat
 4 | 
 5 | COPY run-stuff.sh /run-stuff.sh
 6 | RUN chmod +x /run-stuff.sh
 7 | 
 8 | RUN kibana plugin --install elastic/sense
 9 | RUN kibana plugin --install elastic/timelion
10 | 
11 | CMD ["/run-stuff.sh"]
12 | 


--------------------------------------------------------------------------------
/blog/kibana/config/kibana.yml:
--------------------------------------------------------------------------------
 1 | # Kibana is served by a back end server. This controls which port to use.
 2 | port: 5601
 3 | 
 4 | # The host to bind the server to.
 5 | host: "0.0.0.0"
 6 | 
 7 | # The Elasticsearch instance to use for all your queries.
 8 | elasticsearch_url: "http://elasticsearch:9200"
 9 | 
10 | # preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false,
11 | # then the host you use to connect to *this* Kibana instance will be sent.
12 | elasticsearch_preserve_host: true
13 | 
14 | # Kibana uses an index in Elasticsearch to store saved searches, visualizations
15 | # and dashboards. It will create a new index if it doesn't already exist.
16 | kibana_index: ".kibana"
17 | 
18 | # If your Elasticsearch is protected with basic auth, this is the user credentials
19 | # used by the Kibana server to perform maintence on the kibana_index at statup. Your Kibana
20 | # users will still need to authenticate with Elasticsearch (which is proxied thorugh
21 | # the Kibana server)
22 | # kibana_elasticsearch_username: user
23 | # kibana_elasticsearch_password: pass
24 | 
25 | # If your Elasticsearch requires client certificate and key
26 | # kibana_elasticsearch_client_crt: /path/to/your/client.crt
27 | # kibana_elasticsearch_client_key: /path/to/your/client.key
28 | 
29 | # If you need to provide a CA certificate for your Elasticsarech instance, put
30 | # the path of the pem file here.
31 | # ca: /path/to/your/CA.pem
32 | 
33 | # The default application to load.
34 | default_app_id: "discover"
35 | 
36 | # Time in milliseconds to wait for elasticsearch to respond to pings, defaults to
37 | # request_timeout setting
38 | # ping_timeout: 1500
39 | 
40 | # Time in milliseconds to wait for responses from the back end or elasticsearch.
41 | # This must be > 0
42 | request_timeout: 300000
43 | 
44 | # Time in milliseconds for Elasticsearch to wait for responses from shards.
45 | # Set to 0 to disable.
46 | shard_timeout: 0
47 | 
48 | # Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
49 | # startup_timeout: 5000
50 | 
51 | # Set to false to have a complete disregard for the validity of the SSL
52 | # certificate.
53 | verify_ssl: true
54 | 
55 | # SSL for outgoing requests from the Kibana Server (PEM formatted)
56 | # ssl_key_file: /path/to/your/server.key
57 | # ssl_cert_file: /path/to/your/server.crt
58 | 
59 | # Set the path to where you would like the process id file to be created.
60 | # pid_file: /var/run/kibana.pid
61 | 
62 | # If you would like to send the log output to a file you can set the path below.
63 | # This will also turn off the STDOUT log output.
64 | # log_file: ./kibana.log
65 | # Plugins that are included in the build, and no longer found in the plugins/ folder
66 | bundled_plugin_ids:
67 |  - plugins/dashboard/index
68 |  - plugins/discover/index
69 |  - plugins/doc/index
70 |  - plugins/kibana/index
71 |  - plugins/markdown_vis/index
72 |  - plugins/metric_vis/index
73 |  - plugins/settings/index
74 |  - plugins/table_vis/index
75 |  - plugins/vis_types/index
76 |  - plugins/visualize/index
77 | 


--------------------------------------------------------------------------------
/blog/kibana/run-stuff.sh:
--------------------------------------------------------------------------------
 1 | #!/usr/bin/env bash
 2 | 
 3 | # Wait for the Elasticsearch container to be ready before starting Kibana.
 4 | echo "Stalling for Elasticsearch"
 5 | while true; do
 6 |     nc -q 1 elasticsearch 9200 2>/dev/null && break
 7 | done
 8 | 
 9 | echo "Starting Kibana"
10 | exec kibana
11 | 


--------------------------------------------------------------------------------
/blog/mysql/Dockerfile:
--------------------------------------------------------------------------------
 1 | FROM orchardup/mysql
 2 | 
 3 | RUN apt-get update 
 4 | RUN apt-get install -y nagios-plugins
 5 | RUN apt-get install -y vim wget make
 6 | 
 7 | ENV URL 'https://github.com/PhaedrusTheGreek/nagioscheckbeat/blob/master/build/nagioscheckbeat_0.5.3_amd64.deb?raw=true'
 8 | ENV FILE /tmp/tmp-file.deb	
 9 | RUN wget --no-check-certificate "$URL" -qO $FILE && dpkg -i $FILE; rm $FILE
10 | 
11 | EXPOSE 3306
12 | 
13 | COPY nagioscheckbeat.yml /etc/nagioscheckbeat/nagioscheckbeat.yml
14 | 
15 | ADD install-check.sh /install-check.sh
16 | RUN chmod -v +x /install-check.sh
17 | RUN /install-check.sh
18 | 
19 | ADD run-stuff.sh /run-stuff.sh
20 | RUN chmod -v +x /run-stuff.sh
21 | 
22 | CMD ["/run-stuff.sh"]
23 | 


--------------------------------------------------------------------------------
/blog/mysql/check_mysql_health-2.2.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PhaedrusTheGreek/nagioscheckbeat/d67fb558ab997869e2c6e8c30fee8e84de5336fd/blog/mysql/check_mysql_health-2.2.1.tar.gz


--------------------------------------------------------------------------------
/blog/mysql/install-check.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/bash
 2 | 
 3 | cd /tmp/
 4 | wget --no-check-certificate https://labs.consol.de/assets/downloads/nagios/check_mysql_health-2.2.1.tar.gz
 5 | tar xvzf check_mysql_health-2.2.1.tar.gz 
 6 | cd /tmp/check_mysql_health-2.2.1
 7 | ./configure --prefix=/usr/lib/nagios
 8 | make install
 9 | 
10 | 


--------------------------------------------------------------------------------
/blog/mysql/nagioscheckbeat.yml:
--------------------------------------------------------------------------------
  1 | ################### NagiosCheckBeat Configuration Example #########################
  2 | 
  3 | ############################# Input ############################################
  4 | input:
  5 |   checks:
  6 |     -
  7 |       name: "heartbeat"
  8 |       cmd: "/usr/lib/nagios/plugins/check_dummy"
  9 |       args: "0 Hello"
 10 |       period: "10s"
 11 |     -
 12 |       period: "10s"
 13 |       name: "mysql_slow_queries"
 14 |       cmd: "/usr/lib/nagios/libexec/check_mysql_health"
 15 |       args: "--mode slow-queries"
 16 |     -
 17 |       period: "10s"
 18 |       name: "mysql_index_hitrate"
 19 |       cmd: "/usr/lib/nagios/libexec/check_mysql_health"
 20 |       args: "--mode index-usage"
 21 |     -
 22 |       period: "10s"
 23 |       name: "mysql_query_cache_hitrate"
 24 |       cmd: "/usr/lib/nagios/libexec/check_mysql_health"
 25 |       args: "--mode qcache-hitrate"
 26 |     -
 27 |       period: "10s"
 28 |       name: "mysql_table_cache_hitrate"
 29 |       cmd: "/usr/lib/nagios/libexec/check_mysql_health"
 30 |       args: "--mode tablecache-hitrate"
 31 |     -
 32 |       period: "10s"
 33 |       name: "mysql_threads_running"
 34 |       cmd: "/usr/lib/nagios/libexec/check_mysql_health"
 35 |       args: "--mode threads-running"
 36 | 
 37 | ###############################################################################
 38 | ############################# Libbeat Config ##################################
 39 | # Base config file used by all other beats for using libbeat features
 40 | 
 41 | ############################# Output ##########################################
 42 | 
 43 | # Configure what outputs to use when sending the data collected by the beat.
 44 | # Multiple outputs may be used.
 45 | output:
 46 | 
 47 |   ### Elasticsearch as output
 48 |   elasticsearch:
 49 |     # Array of hosts to connect to.
 50 |     # Scheme and port can be left out and will be set to the default (http and 9200)
 51 |     # In case you specify and additional path, the scheme is required: http://localhost:9200/path
 52 |     # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
 53 |     hosts: ["elasticsearch:9200"]
 54 | 
 55 |     # Optional protocol and basic auth credentials. These are deprecated.
 56 |     #protocol: "https"
 57 |     #username: "admin"
 58 |     #password: "s3cr3t"
 59 | 
 60 |     # Number of workers per Elasticsearch host.
 61 |     #worker: 1
 62 | 
 63 |     # Optional index name. The default is "nagioscheckbeat" and generates
 64 |     # [nagioscheckbeat-]YYYY.MM.DD keys.
 65 |     #index: "nagioscheckbeat"
 66 | 
 67 |     # Optional HTTP Path
 68 |     #path: "/elasticsearch"
 69 | 
 70 |     # The number of times a particular Elasticsearch index operation is attempted. If
 71 |     # the indexing operation doesn't succeed after this many retries, the events are
 72 |     # dropped. The default is 3.
 73 |     #max_retries: 3
 74 | 
 75 |     # The maximum number of events to bulk in a single Elasticsearch bulk API index request.
 76 |     # The default is 50.
 77 |     #bulk_max_size: 50
 78 | 
 79 |     # Configure http request timeout before failing an request to Elasticsearch.
 80 |     #timeout: 90
 81 | 
 82 |     # The number of seconds to wait for new events between two bulk API index requests.
 83 |     # If `bulk_max_size` is reached before this interval expires, addition bulk index
 84 |     # requests are made.
 85 |     #flush_interval: 1
 86 | 
 87 |     # Boolean that sets if the topology is kept in Elasticsearch. The default is
 88 |     # false. This option makes sense only for Packetbeat.
 89 |     #save_topology: false
 90 | 
 91 |     # The time to live in seconds for the topology information that is stored in
 92 |     # Elasticsearch. The default is 15 seconds.
 93 |     #topology_expire: 15
 94 | 
 95 |     # tls configuration. By default is off.
 96 |     #tls:
 97 |       # List of root certificates for HTTPS server verifications
 98 |       #certificate_authorities: ["/etc/pki/root/ca.pem"]
 99 | 
100 |       # Certificate for TLS client authentication
101 |       #certificate: "/etc/pki/client/cert.pem"
102 | 
103 |       # Client Certificate Key
104 |       #certificate_key: "/etc/pki/client/cert.key"
105 | 
106 |       # Controls whether the client verifies server certificates and host name.
107 |       # If insecure is set to true, all server host names and certificates will be
108 |       # accepted. In this mode TLS based connections are susceptible to
109 |       # man-in-the-middle attacks. Use only for testing.
110 |       #insecure: true
111 | 
112 |       # Configure cipher suites to be used for TLS connections
113 |       #cipher_suites: []
114 | 
115 |       # Configure curve types for ECDHE based cipher suites
116 |       #curve_types: []
117 | 
118 |       # Configure minimum TLS version allowed for connection to logstash
119 |       #min_version: 1.0
120 | 
121 |       # Configure maximum TLS version allowed for connection to logstash
122 |       #max_version: 1.2
123 | 
124 | 
125 |   ### Logstash as output
126 |   #logstash:
127 |     # The Logstash hosts
128 |     #hosts: ["localhost:5044"]
129 | 
130 |     # Number of workers per Logstash host.
131 |     #worker: 1
132 | 
133 |     # Optional load balance the events between the Logstash hosts
134 |     #loadbalance: true
135 | 
136 |     # Optional index name. The default index name depends on the each beat.
137 |     # For Packetbeat, the default is set to packetbeat, for Topbeat
138 |     # to topbeat and for Filebeat to filebeat.
139 |     #index: nagioscheckbeat
140 | 
141 |     # Optional TLS. By default is off.
142 |     #tls:
143 |       # List of root certificates for HTTPS server verifications
144 |       #certificate_authorities: ["/etc/pki/root/ca.pem"]
145 | 
146 |       # Certificate for TLS client authentication
147 |       #certificate: "/etc/pki/client/cert.pem"
148 | 
149 |       # Client Certificate Key
150 |       #certificate_key: "/etc/pki/client/cert.key"
151 | 
152 |       # Controls whether the client verifies server certificates and host name.
153 |       # If insecure is set to true, all server host names and certificates will be
154 |       # accepted. In this mode TLS based connections are susceptible to
155 |       # man-in-the-middle attacks. Use only for testing.
156 |       #insecure: true
157 | 
158 |       # Configure cipher suites to be used for TLS connections
159 |       #cipher_suites: []
160 | 
161 |       # Configure curve types for ECDHE based cipher suites
162 |       #curve_types: []
163 | 
164 | 
165 |   ### File as output
166 |   #file:
167 |     # Path to the directory where to save the generated files. The option is mandatory.
168 |     #path: "/tmp/nagioscheckbeat"
169 | 
170 |     # Name of the generated files. The default is `nagioscheckbeat` and it generates files: `nagioscheckbeat`, `nagioscheckbeat.1`, `nagioscheckbeat.2`, etc.
171 |     #filename: nagioscheckbeat
172 | 
173 |     # Maximum size in kilobytes of each file. When this size is reached, the files are
174 |     # rotated. The default value is 10 MB.
175 |     #rotate_every_kb: 10000
176 | 
177 |     # Maximum number of files under path. When this number of files is reached, the
178 |     # oldest file is deleted and the rest are shifted from last to first. The default
179 |     # is 7 files.
180 |     #number_of_files: 7
181 | 
182 | 
183 |   ### Console output
184 |   # console:
185 |     # Pretty print json event
186 |     #pretty: false
187 | 
188 | 
189 | ############################# Shipper #########################################
190 | 
191 | shipper:
192 |   # The name of the shipper that publishes the network data. It can be used to group
193 |   # all the transactions sent by a single shipper in the web interface.
194 |   # If this options is not defined, the hostname is used.
195 |   #name:
196 | 
197 |   # The tags of the shipper are included in their own field with each
198 |   # transaction published. Tags make it easy to group servers by different
199 |   # logical properties.
200 |   #tags: ["service-X", "web-tier"]
201 | 
202 |   # Uncomment the following if you want to ignore transactions created
203 |   # by the server on which the shipper is installed. This option is useful
204 |   # to remove duplicates if shippers are installed on multiple servers.
205 |   #ignore_outgoing: true
206 | 
207 |   # How often (in seconds) shippers are publishing their IPs to the topology map.
208 |   # The default is 10 seconds.
209 |   #refresh_topology_freq: 10
210 | 
211 |   # Expiration time (in seconds) of the IPs published by a shipper to the topology map.
212 |   # All the IPs will be deleted afterwards. Note, that the value must be higher than
213 |   # refresh_topology_freq. The default is 15 seconds.
214 |   #topology_expire: 15
215 | 
216 |   # Configure local GeoIP database support.
217 |   # If no paths are not configured geoip is disabled.
218 |   #geoip:
219 |     #paths:
220 |     #  - "/usr/share/GeoIP/GeoLiteCity.dat"
221 |     #  - "/usr/local/var/GeoIP/GeoLiteCity.dat"
222 | 
223 | 
224 | ############################# Logging #########################################
225 | 
226 | # There are three options for the log ouput: syslog, file, stderr.
227 | # Under Windos systems, the log files are per default sent to the file output,
228 | # under all other system per default to syslog.
229 | logging:
230 | 
231 |   # Send all logging output to syslog. On Windows default is false, otherwise
232 |   # default is true.
233 |   #to_syslog: true
234 | 
235 |   # Write all logging output to files. Beats automatically rotate files if rotateeverybytes
236 |   # limit is reached.
237 |   to_files: true
238 | 
239 |   # To enable logging to files, to_files option has to be set to true
240 |   files:
241 |     # The directory where the log files will written to.
242 |     path: /var/log/nagioscheck
243 | 
244 |     # The name of the files where the logs are written to.
245 |     name: beat
246 | 
247 |     # Configure log file size limit. If limit is reached, log file will be
248 |     # automatically rotated
249 |     rotateeverybytes: 10485760 # = 10MB
250 | 
251 |     # Number of rotated log files to keep. Oldest files will be deleted first.
252 |     #keepfiles: 7
253 | 
254 |   # Enable debug output for selected components. To enable all selectors use ["*"]
255 |   # Other available selectors are beat, publish, service
256 |   # Multiple selectors can be chained.
257 |   selectors: ["*"]
258 | 
259 |   # Sets log level. The default log level is error.
260 |   # Available log levels are: critical, error, warning, info, debug
261 |   level: debug
262 | 
263 | 
264 | 


--------------------------------------------------------------------------------
/blog/mysql/run-stuff.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | 
3 | /usr/bin/nagioscheckbeat -c /etc/nagioscheckbeat/nagioscheckbeat.yml &
4 | 
5 | /usr/sbin/mysqld
6 | 
7 | 
8 | 


--------------------------------------------------------------------------------
/blog/redis/Dockerfile:
--------------------------------------------------------------------------------
 1 | FROM ubuntu
 2 | 
 3 | RUN apt-get update && apt-get install -y redis-server wget 
 4 | RUN apt-get install -y nagios-plugins 
 5 | RUN apt-get install -y libredis-perl
 6 | 
 7 | ENV URL 'https://github.com/PhaedrusTheGreek/nagioscheckbeat/blob/master/build/nagioscheckbeat_0.5.3_amd64.deb?raw=true'
 8 | ENV FILE /tmp/tmp-file.deb	
 9 | RUN wget "$URL" -qO $FILE && dpkg -i $FILE; rm $FILE
10 | 
11 | EXPOSE 6379
12 | 
13 | COPY nagioscheckbeat.yml /etc/nagioscheckbeat/nagioscheckbeat.yml
14 | 
15 | COPY check_redis.pl /usr/lib/nagios/plugins/check_redis.pl
16 | RUN chmod +x /usr/lib/nagios/plugins/check_redis.pl
17 | 
18 | ADD run-stuff.sh /run-stuff.sh
19 | RUN chmod -v +x /run-stuff.sh
20 | 
21 | CMD ["/run-stuff.sh"]
22 | 


--------------------------------------------------------------------------------
/blog/redis/nagioscheckbeat.yml:
--------------------------------------------------------------------------------
  1 | ################### NagiosCheckBeat Configuration Example #########################
  2 | 
  3 | ############################# Input ############################################
  4 | input:
  5 |   checks:
  6 |     -
  7 |       name: "heartbeat"
  8 |       cmd: "/usr/lib/nagios/plugins/check_dummy"
  9 |       args: "0 Hello"
 10 |       period: "10s"
 11 |     -
 12 |       period: "10s"
 13 |       name: "redis"
 14 |       cmd: "/usr/lib/nagios/plugins/check_redis.pl"
 15 |       args: "-H 127.0.0.1 -R -m -T -f -A"
 16 | 
 17 | ###############################################################################
 18 | ############################# Libbeat Config ##################################
 19 | # Base config file used by all other beats for using libbeat features
 20 | 
 21 | ############################# Output ##########################################
 22 | 
 23 | # Configure what outputs to use when sending the data collected by the beat.
 24 | # Multiple outputs may be used.
 25 | output:
 26 | 
 27 |   ### Elasticsearch as output
 28 |   elasticsearch:
 29 |     # Array of hosts to connect to.
 30 |     # Scheme and port can be left out and will be set to the default (http and 9200)
 31 |     # In case you specify and additional path, the scheme is required: http://localhost:9200/path
 32 |     # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
 33 |     hosts: ["elasticsearch:9200"]
 34 | 
 35 |     # Optional protocol and basic auth credentials. These are deprecated.
 36 |     #protocol: "https"
 37 |     #username: "admin"
 38 |     #password: "s3cr3t"
 39 | 
 40 |     # Number of workers per Elasticsearch host.
 41 |     #worker: 1
 42 | 
 43 |     # Optional index name. The default is "nagioscheckbeat" and generates
 44 |     # [nagioscheckbeat-]YYYY.MM.DD keys.
 45 |     #index: "nagioscheckbeat"
 46 | 
 47 |     # Optional HTTP Path
 48 |     #path: "/elasticsearch"
 49 | 
 50 |     # The number of times a particular Elasticsearch index operation is attempted. If
 51 |     # the indexing operation doesn't succeed after this many retries, the events are
 52 |     # dropped. The default is 3.
 53 |     #max_retries: 3
 54 | 
 55 |     # The maximum number of events to bulk in a single Elasticsearch bulk API index request.
 56 |     # The default is 50.
 57 |     #bulk_max_size: 50
 58 | 
 59 |     # Configure http request timeout before failing an request to Elasticsearch.
 60 |     #timeout: 90
 61 | 
 62 |     # The number of seconds to wait for new events between two bulk API index requests.
 63 |     # If `bulk_max_size` is reached before this interval expires, addition bulk index
 64 |     # requests are made.
 65 |     #flush_interval: 1
 66 | 
 67 |     # Boolean that sets if the topology is kept in Elasticsearch. The default is
 68 |     # false. This option makes sense only for Packetbeat.
 69 |     #save_topology: false
 70 | 
 71 |     # The time to live in seconds for the topology information that is stored in
 72 |     # Elasticsearch. The default is 15 seconds.
 73 |     #topology_expire: 15
 74 | 
 75 |     # tls configuration. By default is off.
 76 |     #tls:
 77 |       # List of root certificates for HTTPS server verifications
 78 |       #certificate_authorities: ["/etc/pki/root/ca.pem"]
 79 | 
 80 |       # Certificate for TLS client authentication
 81 |       #certificate: "/etc/pki/client/cert.pem"
 82 | 
 83 |       # Client Certificate Key
 84 |       #certificate_key: "/etc/pki/client/cert.key"
 85 | 
 86 |       # Controls whether the client verifies server certificates and host name.
 87 |       # If insecure is set to true, all server host names and certificates will be
 88 |       # accepted. In this mode TLS based connections are susceptible to
 89 |       # man-in-the-middle attacks. Use only for testing.
 90 |       #insecure: true
 91 | 
 92 |       # Configure cipher suites to be used for TLS connections
 93 |       #cipher_suites: []
 94 | 
 95 |       # Configure curve types for ECDHE based cipher suites
 96 |       #curve_types: []
 97 | 
 98 |       # Configure minimum TLS version allowed for connection to logstash
 99 |       #min_version: 1.0
100 | 
101 |       # Configure maximum TLS version allowed for connection to logstash
102 |       #max_version: 1.2
103 | 
104 | 
105 |   ### Logstash as output
106 |   #logstash:
107 |     # The Logstash hosts
108 |     #hosts: ["localhost:5044"]
109 | 
110 |     # Number of workers per Logstash host.
111 |     #worker: 1
112 | 
113 |     # Optional load balance the events between the Logstash hosts
114 |     #loadbalance: true
115 | 
116 |     # Optional index name. The default index name depends on the each beat.
117 |     # For Packetbeat, the default is set to packetbeat, for Topbeat
118 |     # to topbeat and for Filebeat to filebeat.
119 |     #index: nagioscheckbeat
120 | 
121 |     # Optional TLS. By default is off.
122 |     #tls:
123 |       # List of root certificates for HTTPS server verifications
124 |       #certificate_authorities: ["/etc/pki/root/ca.pem"]
125 | 
126 |       # Certificate for TLS client authentication
127 |       #certificate: "/etc/pki/client/cert.pem"
128 | 
129 |       # Client Certificate Key
130 |       #certificate_key: "/etc/pki/client/cert.key"
131 | 
132 |       # Controls whether the client verifies server certificates and host name.
133 |       # If insecure is set to true, all server host names and certificates will be
134 |       # accepted. In this mode TLS based connections are susceptible to
135 |       # man-in-the-middle attacks. Use only for testing.
136 |       #insecure: true
137 | 
138 |       # Configure cipher suites to be used for TLS connections
139 |       #cipher_suites: []
140 | 
141 |       # Configure curve types for ECDHE based cipher suites
142 |       #curve_types: []
143 | 
144 | 
145 |   ### File as output
146 |   #file:
147 |     # Path to the directory where to save the generated files. The option is mandatory.
148 |     #path: "/tmp/nagioscheckbeat"
149 | 
150 |     # Name of the generated files. The default is `nagioscheckbeat` and it generates files: `nagioscheckbeat`, `nagioscheckbeat.1`, `nagioscheckbeat.2`, etc.
151 |     #filename: nagioscheckbeat
152 | 
153 |     # Maximum size in kilobytes of each file. When this size is reached, the files are
154 |     # rotated. The default value is 10 MB.
155 |     #rotate_every_kb: 10000
156 | 
157 |     # Maximum number of files under path. When this number of files is reached, the
158 |     # oldest file is deleted and the rest are shifted from last to first. The default
159 |     # is 7 files.
160 |     #number_of_files: 7
161 | 
162 | 
163 |   ### Console output
164 |   # console:
165 |     # Pretty print json event
166 |     #pretty: false
167 | 
168 | 
169 | ############################# Shipper #########################################
170 | 
171 | shipper:
172 |   # The name of the shipper that publishes the network data. It can be used to group
173 |   # all the transactions sent by a single shipper in the web interface.
174 |   # If this options is not defined, the hostname is used.
175 |   #name:
176 | 
177 |   # The tags of the shipper are included in their own field with each
178 |   # transaction published. Tags make it easy to group servers by different
179 |   # logical properties.
180 |   #tags: ["service-X", "web-tier"]
181 | 
182 |   # Uncomment the following if you want to ignore transactions created
183 |   # by the server on which the shipper is installed. This option is useful
184 |   # to remove duplicates if shippers are installed on multiple servers.
185 |   #ignore_outgoing: true
186 | 
187 |   # How often (in seconds) shippers are publishing their IPs to the topology map.
188 |   # The default is 10 seconds.
189 |   #refresh_topology_freq: 10
190 | 
191 |   # Expiration time (in seconds) of the IPs published by a shipper to the topology map.
192 |   # All the IPs will be deleted afterwards. Note, that the value must be higher than
193 |   # refresh_topology_freq. The default is 15 seconds.
194 |   #topology_expire: 15
195 | 
196 |   # Configure local GeoIP database support.
197 |   # If no paths are not configured geoip is disabled.
198 |   #geoip:
199 |     #paths:
200 |     #  - "/usr/share/GeoIP/GeoLiteCity.dat"
201 |     #  - "/usr/local/var/GeoIP/GeoLiteCity.dat"
202 | 
203 | 
204 | ############################# Logging #########################################
205 | 
206 | # There are three options for the log ouput: syslog, file, stderr.
207 | # Under Windos systems, the log files are per default sent to the file output,
208 | # under all other system per default to syslog.
209 | logging:
210 | 
211 |   # Send all logging output to syslog. On Windows default is false, otherwise
212 |   # default is true.
213 |   #to_syslog: true
214 | 
215 |   # Write all logging output to files. Beats automatically rotate files if rotateeverybytes
216 |   # limit is reached.
217 |   to_files: true
218 | 
219 |   # To enable logging to files, to_files option has to be set to true
220 |   files:
221 |     # The directory where the log files will written to.
222 |     path: /var/log/nagioscheck
223 | 
224 |     # The name of the files where the logs are written to.
225 |     name: beat
226 | 
227 |     # Configure log file size limit. If limit is reached, log file will be
228 |     # automatically rotated
229 |     rotateeverybytes: 10485760 # = 10MB
230 | 
231 |     # Number of rotated log files to keep. Oldest files will be deleted first.
232 |     #keepfiles: 7
233 | 
234 |   # Enable debug output for selected components. To enable all selectors use ["*"]
235 |   # Other available selectors are beat, publish, service
236 |   # Multiple selectors can be chained.
237 |   selectors: ["*"]
238 | 
239 |   # Sets log level. The default log level is error.
240 |   # Available log levels are: critical, error, warning, info, debug
241 |   level: debug
242 | 
243 | 
244 | 


--------------------------------------------------------------------------------
/blog/redis/run-stuff.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | 
3 | /usr/bin/nagioscheckbeat -c /etc/nagioscheckbeat/nagioscheckbeat.yml &
4 | 
5 | /usr/bin/redis-server
6 | 


--------------------------------------------------------------------------------
/blog/watch-heartbeat.sense:
--------------------------------------------------------------------------------
 1 | PUT _watcher/watch/heartbeat_watch
 2 | {
 3 |   "trigger" : {
 4 |       "schedule" : {
 5 |         "interval" : "1m"
 6 |     }
 7 |   },
 8 |   "input" : {
 9 |     "search" : {
10 |       "request" : {
11 |         "indices" : [ "nagioscheckbeat*" ],
12 |         "body" : {  
13 |            "query":{  
14 |               "filtered":{  
15 |                  "query" : {
16 |                     "bool" : {
17 |                       "must" : [
18 |                           { "term" : {"_type": "nagioscheck"} },
19 |                           { "range" : {"@timestamp" : {"gte" : "now-1d"}} }
20 |                       ]
21 |                     }
22 |                  }
23 |               }
24 |            },
25 |             "aggs": {
26 |                 "hosts": {
27 |                     "terms": {
28 |                         "field": "beat.hostname"
29 |                     },
30 |                     "aggs": {
31 |                         "latest_heartbeat": {
32 |                             "top_hits": {
33 |                                 "sort": [
34 |                                     {
35 |                                         "@timestamp": {
36 |                                             "order": "desc"
37 |                                         }
38 |                                     }
39 |                                 ],
40 |                                 "_source": {
41 |                                     "include": [
42 |                                         "@timestamp"
43 |                                     ]
44 |                                 },
45 |                                 "size" : 1
46 |                             }
47 |                         }
48 |                     }
49 |                 }
50 |             },
51 |             "size": 0
52 |         }
53 |       }
54 |     }
55 |   },
56 |   "condition" : {
57 |     "script" : {
58 |       "file" : "monitor-hosts",
59 |       "params" : {
60 |         "threshold" : 0
61 |       }
62 |     }
63 |   },
64 |   "actions" : {
65 |     "send_email" : {
66 |       "throttle_period": "1h", 
67 |       "email" : {
68 |         "to" : "jay.greenberg@elastic.co",  
69 |         "subject" : "Alert from Watcher - Host(s) Down",
70 |         "body" : "One or more hosts have not checked in recently.  See the attached file for details.  You will not receive another notification for 1 hour.",
71 |         "attach_data" : true,
72 | 	"priority" : "high"
73 |       }
74 |     }
75 |   }
76 | }
77 | 


--------------------------------------------------------------------------------
/blog/watch-thresholds.sense:
--------------------------------------------------------------------------------
 1 | PUT _watcher/watch/critical_watch
 2 | {
 3 |   "trigger" : {
 4 |       "schedule" : {
 5 |         "interval" : "1m"
 6 |     }
 7 |   },
 8 |   "input" : {
 9 |     "search" : {
10 |       "request" : {
11 |         "indices" : [ "nagioscheckbeat*" ],
12 |         "body" : {  
13 |            "query":{  
14 |               "filtered":{  
15 |                  "query" : {
16 |                     "bool" : {
17 |                       "must" : [
18 |                             { "term" : {"_type": "nagioscheck"} },
19 |                             { "range" : {"@timestamp" : {"gte" : "now-30m"}} },
20 |                             { "term" : {"status" : "CRITICAL" } }
21 |                       ]
22 |                     }
23 |                  }
24 |               }
25 |            }
26 |         }
27 |       }
28 |     }
29 |   },
30 |   "condition" : {
31 |     "compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}
32 |   },
33 |   "actions" : {
34 |     "send_email" : {
35 |       "throttle_period": "30m", 
36 |       "email" : {
37 |         "to" : "jay.greenberg@elastic.co",  
38 |         "subject" : "Alert from Watcher - Service(s) Critical",
39 |         "body" : "One or more services reported a CRITICAL state within the last 30 minutes.  See the attached file for details.  You will not receive another notification for 30 minutes.",
40 |         "attach_data" : true
41 |       }
42 |     }
43 |   }
44 | }
45 | 
46 | 


--------------------------------------------------------------------------------
/check/check.go:
--------------------------------------------------------------------------------
  1 | package check
  2 | 
  3 | import (
  4 | 	"errors"
  5 | 	"github.com/PhaedrusTheGreek/nagioscheckbeat/config"
  6 | 	"github.com/PhaedrusTheGreek/nagioscheckbeat/nagiosperf"
  7 | 	"github.com/elastic/beats/libbeat/beat"
  8 | 	"github.com/elastic/beats/libbeat/common"
  9 | 	"github.com/elastic/beats/libbeat/logp"
 10 | 	"github.com/mgutz/str"
 11 | 	"os/exec"
 12 | 	"strings"
 13 | 	"syscall"
 14 | 	"time"
 15 | )
 16 | 
 17 | type NagiosCheck struct {
 18 | 	duration time.Duration
 19 | 
 20 | 	name    string
 21 | 	enabled bool
 22 | 	cmd     string
 23 | 	args    string
 24 | }
 25 | 
 26 | func (nagiosCheck *NagiosCheck) Setup(config *config.NagiosCheckConfig) error {
 27 | 
 28 | 	if config == nil {
 29 | 		return errors.New("Invalid/Missing Nagios Check Configuration")
 30 | 	}
 31 | 
 32 | 	if config.Name == nil {
 33 | 		return errors.New("Must Specify a Nagios Check Name")
 34 | 	}
 35 | 	nagiosCheck.name = *config.Name
 36 | 
 37 | 	if config.Cmd == nil {
 38 | 		return errors.New("Must Specify a Nagios Check Command")
 39 | 	}
 40 | 	nagiosCheck.cmd = *config.Cmd
 41 | 
 42 | 	nagiosCheck.args = ""
 43 | 	if config.Args != nil {
 44 | 		nagiosCheck.args = *config.Args
 45 | 	}
 46 | 
 47 | 	nagiosCheck.enabled = true
 48 | 	if config.Enabled != nil && !*config.Enabled {
 49 | 		nagiosCheck.enabled = false
 50 | 	}
 51 | 
 52 | 	nagiosCheck.duration = 60 * time.Second
 53 | 	if config.Period != 0 {
 54 | 		nagiosCheck.duration = config.Period
 55 | 	}
 56 | 
 57 | 	return nil
 58 | }
 59 | 
 60 | func (nagiosCheck *NagiosCheck) Run(publish func([]beat.Event)) {
 61 | 
 62 | 	if !nagiosCheck.enabled {
 63 | 		logp.Info("Not starting module %s as not enabled.", nagiosCheck.name)
 64 | 		return
 65 | 	}
 66 | 
 67 | 	logp.Info("Starting metric %s with period %v", nagiosCheck.name, nagiosCheck.duration)
 68 | 
 69 | 	ticker := time.NewTicker(nagiosCheck.duration)
 70 | 	defer ticker.Stop()
 71 | 
 72 | 	for range ticker.C {
 73 | 		events, err := nagiosCheck.Check()
 74 | 		if err != nil {
 75 | 			logp.Err("Error On Command: %q: %v", nagiosCheck.name, err)
 76 | 		}
 77 | 		publish(events)
 78 | 	}
 79 | 
 80 | }
 81 | 
 82 | func (nagiosCheck *NagiosCheck) Check() (events []beat.Event, err error) {
 83 | 
 84 | 	startTime := time.Now()
 85 | 	startMs := startTime.UnixNano() / int64(time.Millisecond)
 86 | 
 87 | 	check_event := beat.Event{
 88 | 		Timestamp: startTime,
 89 | 		Fields: common.MapStr{
 90 | 			"type":       "nagioscheck",
 91 | 			"name":       nagiosCheck.name,
 92 | 			"cmd":        nagiosCheck.cmd,
 93 | 			"args":       nagiosCheck.args,
 94 | 		},
 95 | 	}
 96 | 
 97 | 	logp.Debug("nagioscheck", "Running Command: %q", nagiosCheck.cmd)
 98 | 
 99 | 	arg_fields := str.ToArgv(nagiosCheck.args)
100 | 
101 | 	cmd := exec.Command(nagiosCheck.cmd, arg_fields...)
102 | 	var waitStatus syscall.WaitStatus
103 | 
104 | 	/* Go will return 'err' if the command exits abnormally (non-zero return code).
105 | 	Nagios commands always will exit abnormally when a check fails, so from
106 | 	a funcational perspective, this doesn't help us.  Instead, if the ProcessState is nil,
107 | 	that tells us that the command coulnd't run for some reason, which does help.
108 | 	*/
109 | 
110 | 	output, err := cmd.CombinedOutput()
111 | 	if cmd.ProcessState == nil {
112 | 		return
113 | 	}
114 | 
115 | 	waitStatus = cmd.ProcessState.Sys().(syscall.WaitStatus)
116 | 
117 | 	logp.Debug("nagioscheck", "Command Returned: %q, exit code %d", output, waitStatus.ExitStatus())
118 | 
119 | 	parts := strings.Split(string(output), "|")
120 | 	check_event.Fields["message"] = parts[0]
121 | 	check_event.Fields["status"] = nagiosperf.NiceStatus(waitStatus.ExitStatus())
122 | 	check_event.Fields["status_code"] = waitStatus.ExitStatus()
123 | 	check_event.Fields["took_ms"] = time.Now().UnixNano()/int64(time.Millisecond) - startMs
124 | 
125 | 	// publish the check result, even if there is no perf data
126 | 	events = append(events, check_event)
127 | 
128 | 	if len(parts) > 1 {
129 | 		logp.Debug("nagioscheck", "Parsing: %q", parts[1])
130 | 		perfs, errors := nagiosperf.ParsePerfString(parts[1])
131 | 		if len(errors) > 0 {
132 | 			for _, err := range errors {
133 | 				logp.Debug("parse_errors", "Parse Error: %v", err)
134 | 			}
135 | 		}
136 | 
137 | 		logp.Debug("nagioscheck", "Command Returned '%d' Perf Metrics: %v", len(perfs), perfs)
138 | 
139 | 		for _, perf := range perfs {
140 | 
141 | 			metric_event := beat.Event{
142 | 				Timestamp: startTime,
143 | 				Fields: common.MapStr{
144 | 					"type":       "nagiosmetric",
145 | 					"name":       nagiosCheck.name,
146 | 					"label":      perf.Label,
147 | 					"uom":        perf.Uom,
148 | 					"value":      perf.Value,
149 | 					"min":        perf.Min,
150 | 					"max":        perf.Max,
151 | 					"warning":    perf.Warning,
152 | 					"critical":   perf.Critical,
153 | 				},
154 | 			}
155 | 
156 | 			events = append(events, metric_event)
157 | 
158 | 		}
159 | 	}
160 | 
161 | 	return
162 | }
163 | 
164 | func (nagiosCheck *NagiosCheck) Cleanup() error {
165 | 	return nil
166 | }
167 | 


--------------------------------------------------------------------------------
/check/check_test.go:
--------------------------------------------------------------------------------
 1 | package check
 2 | 
 3 | /*
 4 |   Default nagios check locations are assumed to be in /usr/local/sbin/
 5 | */
 6 | 
 7 | import (
 8 | 	"github.com/PhaedrusTheGreek/nagioscheckbeat/config"
 9 | 	"github.com/elastic/beats/libbeat/beat"
10 | 	// "github.com/elastic/beats/libbeat/logp"
11 | 	"strings"
12 | 	"testing"
13 | 	"time"
14 | )
15 | 
16 | func TestCheck(t *testing.T) {
17 | 
18 | 	// logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"*"})
19 | 
20 | 	/*
21 | 		1st Check, makes sure command runs and returns OK
22 | 	*/
23 | 	cmd := "/usr/local/sbin/check_dummy"
24 | 	arg := "0 hello"
25 | 	period := 1 * time.Second
26 | 	name := "dummy"
27 | 
28 | 	checkConfig := config.NagiosCheckConfig{Cmd: &cmd, Args: &arg, Period: period, Name: &name}
29 | 
30 | 	check := NagiosCheck{}
31 | 	check.Setup(&checkConfig)
32 | 	got, err := check.Check()
33 | 
34 | 	if err != nil {
35 | 		t.Errorf("%v", err)
36 | 	}
37 | 
38 | 	// [{"@timestamp":"2016-01-10T05:40:19.738Z","args":"0 hello","cmd":"/usr/local/sbin/check_dummy","message":"OK: hello\n","status":"OK","took_ms":6,"type":"nagioscheck"}]
39 | 
40 | 	var event beat.Event = got[0]
41 | 	var message = event.Fields["message"].(string)
42 | 	if strings.Compare(message, "OK: hello\n") != 0 {
43 | 		t.Errorf("Expected 'OK: hello\\n', and got %q", message)
44 | 	}
45 | 
46 | 	/*
47 | 		2nd Check - makes sure perf data comes along
48 | 	*/
49 | 	cmd = "/usr/local/sbin/check_load"
50 | 	arg = "-w 5 -c 10"
51 | 	period = 1 * time.Second
52 | 	name = "load"
53 | 
54 | 	checkConfig = config.NagiosCheckConfig{Cmd: &cmd, Args: &arg, Period: period, Name: &name}
55 | 
56 | 	check = NagiosCheck{}
57 | 	check.Setup(&checkConfig)
58 | 	got, err = check.Check()
59 | 
60 | 	if err != nil {
61 | 		t.Errorf("%v", err)
62 | 	}
63 | 
64 | 	if len(got) != 4 {
65 | 		t.Errorf("Expected 4 events, but got %d", len(got))
66 | 	}
67 | 
68 | }
69 | 


--------------------------------------------------------------------------------
/cmd/root.go:
--------------------------------------------------------------------------------
 1 | package cmd
 2 | 
 3 | import (
 4 | 	"github.com/PhaedrusTheGreek/nagioscheckbeat/beater"
 5 | 
 6 | 	cmd "github.com/elastic/beats/libbeat/cmd"
 7 | 	"github.com/elastic/beats/libbeat/cmd/instance"
 8 | )
 9 | 
10 | // Name of this beat
11 | var Name = "nagioscheckbeat"
12 | 
13 | // RootCmd to handle beats cli
14 | var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name})
15 | 


--------------------------------------------------------------------------------
/config/config.go:
--------------------------------------------------------------------------------
 1 | // Config is put into a different package to prevent cyclic imports in case
 2 | // it is needed in several locations
 3 | 
 4 | package config
 5 | 
 6 | import "time"
 7 | 
 8 | type NagiosCheckConfig struct {
 9 | 	Cmd     *string       `yaml:"cmd"`
10 | 	Args    *string       `yaml:"args"`
11 | 	Name    *string       `yaml:"name"`
12 | 	Period  time.Duration `yaml:"period"`
13 | 	Enabled *bool         `yaml:"enabled"`
14 | }
15 | 
16 | type Config struct {
17 | 	Checks []NagiosCheckConfig
18 | }
19 | 
20 | 
21 | var DefaultConfig = Config{}
22 | 


--------------------------------------------------------------------------------
/config/config_test.go:
--------------------------------------------------------------------------------
1 | // +build !integration
2 | 
3 | package config
4 | 


--------------------------------------------------------------------------------
/data/meta.json:
--------------------------------------------------------------------------------
1 | {"uuid":"024dd536-295c-457a-977d-1137398e16d4"}
2 | 


--------------------------------------------------------------------------------
/docs/index.asciidoc:
--------------------------------------------------------------------------------
1 | = Nagioscheckbeat Docs
2 | 
3 | Welcome to the Nagioscheckbeat documentation.
4 | 
5 | 
6 | 


--------------------------------------------------------------------------------
/include/fields.go:
--------------------------------------------------------------------------------
 1 | // Licensed to Elasticsearch B.V. under one or more contributor
 2 | // license agreements. See the NOTICE file distributed with
 3 | // this work for additional information regarding copyright
 4 | // ownership. Elasticsearch B.V. licenses this file to you under
 5 | // the Apache License, Version 2.0 (the "License"); you may
 6 | // not use this file except in compliance with the License.
 7 | // You may obtain a copy of the License at
 8 | //
 9 | //     http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied.  See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 | 
18 | // Code generated by beats/dev-tools/cmd/asset/asset.go - DO NOT EDIT.
19 | 
20 | package include
21 | 
22 | import (
23 | 	"github.com/elastic/beats/libbeat/asset"
24 | )
25 | 
26 | func init() {
27 | 	if err := asset.SetFields("nagioscheckbeat", "fields.yml", asset.BeatFieldsPri, AssetFieldsYml); err != nil {
28 | 		panic(err)
29 | 	}
30 | }
31 | 
32 | // AssetFieldsYml returns asset data.
33 | // This is the base64 encoded gzipped contents of fields.yml.
34 | func AssetFieldsYml() string {
35 | 	return "eJzsvfl3IzeSMPi7/wqs+u2nkodKHaU6v9czq5bKtrbr0JRU7e4ezxPBTJCElQmkAaRY9L7937+HCFx5UEdZlMs96pnnEslMIBAIBOKOP5EfDz++P3n//f9FjiUR0hBWcEPMnGsy5SUjBVcsN+VyRLghC6rJjAmmqGEFmSyJmTPy5uiM1Er+zHIz+uZPZEI1K4gU8P0VU5pLQfay/Ww3++ZP5LRkVDNyxTU3ZG5MrV/v7My4mTeTLJfVDiupNjzfYbkmRhLdzGZMG5LPqZgx+MoOO+WsLHT2zTfb5JItXxOW628IMdyU7LV94BtCCqZzxWvDpYCvyHfuHeLefv0NIdtE0Iq9Jpv/j+EV04ZW9eY3hBBSsitWvia5VAw+K/ZLwxUrXhOjGvzKLGv2mhTU4MfWfJvH1LAdOyZZzJkANLErJgyRis+4sOjLvoH3CDm3uOYaHirCe+yzUTS3aJ4qWcURRnZintOyXBLFasU0E4aLGUzkRozTDW6Ylo3KWZj/ZJq8gL+ROdVESA9tSQJ6RkgaV7RsGAAdgKll3ZR2Gjesm2zKlTbwfgcsxXLGryJUNa9ZyUWE66PDOe4XmUpFaFniCDrDfWKfaVXbTd/c3917vr37bHv/6fnuy9e7z14/PchePnv6z81km0s6YaUe3GDcTTmxVAxf4J8X+P0lWy6kKgY2+qjRRlb2gR3ESU250mENR1SQCSONPRJGEloUpGKGEi6mUlXUDmK/d2siZ3PZlAUcw1wKQ7kggmm7dQgOkK/932FZ4h5o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dINbQrFfGq5Y4fjtjXhOvRYAOAYY2qUjQ7cHF8NfIZy0osZ134KnNzUZY9wNdl7ygTeeKWSOC9lnCjdBxWdzQxQzjRKduMc+WtqbDFLlPa6+Px95C6Gz4FaFWj3upsANJKdlM+N2VZ3gYq7dslwN8fFOwa525gXdGxMpCCUF15e4/k4lMVnd03oOdWgo4vK2/ssDnazy2F6Ns4YXrOSC6f9+4pOZkHa3a1ggdKPYKWS+Ex/N5qYqt0bk04d3lu6ffBLckA9T8g5zn7cIFwX0AsHYbOzts6ntpWMGeDMEU7eWXsgmCg/3sJN/g3BtpLO4kWEHfaECsNvghYw97XySGP6UD/V1MnPL9PCOcxlvXX5UcXGb1XkV/4bllXLBFJnIRhQ0lhtTVMxcCl7MSoVknhqtYBg9zqgisOQfqCiwY1Ch6MICP1O0nusMy897qDyqkBbsPdfI6s//d3t59PM9Lq+p669reQuqRIysv48luhGhNJGey9Ky1U+uxVHoFuhPLjJKqmZNFQrwKTZr1Iwb4EpzpliGA7tlVHQJsf6u149jrz8efnx/8v57spgz0Ubiv8dKSQDOCNHKASB4PMQopsVB0pZdSP9G0fyyS/254vaSLO8RgX7IB8bg0ceT85Ojw7cPg8IBSQL+c40oAX+Rj0w3pbmtEFExraNii7tj2GfzhcwXka0ABD+2C0sZYVSZ48Eh8NLdTIj5NulYRtvoe7zkU+g2NTnDvEnQYnCujJAfrWzj+zRMyYe/jvzRGQUKGJFP7//6/sOP76Fg38bJ+78dvj05Jmfnh+efzjYG1pB23HC9EoRhs+Dw+o0LOcHBOis5C4nvuyOyNyL7AO1T16jE338gpUlVxZZY2lDLfDvn2Eh5eVG1dyPJs73LCn6QC4JVaOKRs8NDbUMUNUf29L7jZck1y6Uo9ChWVpksSYfys2/+TwAAAP//b2dFYQ=="
36 | }
37 | 


--------------------------------------------------------------------------------
/logs/nagioscheckbeat:
--------------------------------------------------------------------------------
 1 | 2019-08-20T15:40:12.957Z	INFO	instance/beat.go:606	Home path: [/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat] Config path: [/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat] Data path: [/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat/data] Logs path: [/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat/logs]
 2 | 2019-08-20T15:40:12.976Z	INFO	instance/beat.go:614	Beat ID: 024dd536-295c-457a-977d-1137398e16d4
 3 | 2019-08-20T15:40:12.979Z	INFO	[beat]	instance/beat.go:902	Beat info	{"system_info": {"beat": {"path": {"config": "/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat", "data": "/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat/data", "home": "/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat", "logs": "/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat/logs"}, "type": "nagioscheckbeat", "uuid": "024dd536-295c-457a-977d-1137398e16d4"}}}
 4 | 2019-08-20T15:40:12.979Z	INFO	[beat]	instance/beat.go:911	Build info	{"system_info": {"build": {"commit": "unknown", "libbeat": "8.0.0", "time": "1754-08-30T22:43:41.128Z", "version": "8.0.0"}}}
 5 | 2019-08-20T15:40:12.979Z	INFO	[beat]	instance/beat.go:914	Go runtime info	{"system_info": {"go": {"os":"linux","arch":"amd64","max_procs":4,"version":"go1.12.7"}}}
 6 | 2019-08-20T15:40:12.982Z	INFO	[beat]	instance/beat.go:918	Host info	{"system_info": {"host": {"architecture":"x86_64","boot_time":"2019-08-07T02:02:59Z","containerized":false,"name":"max.layer8ideas.com","ip":["127.0.0.1/8","::1/128","192.168.0.3/24","2607:fea8:2c60:97f::8/128","2607:fea8:2c60:97f:cd90:14f9:a007:997c/64","fd00:f0f2:49a0:cf2:1618:b6b3:d2ba:6619/64","fe80::fab3:8f2d:8b73:27d5/64","172.18.0.1/16","172.17.0.1/16","fe80::42:c0ff:febf:ceef/64","172.19.0.1/16","fe80::42:56ff:fe67:6a1f/64","fe80::70a8:7cff:fe9c:481b/64","fe80::a8a0:a1ff:fe65:c2a/64"],"kernel_version":"3.10.0-957.21.3.el7.x86_64","mac":["00:1e:c9:fe:79:fa","00:1e:c9:fe:79:fb","02:42:6c:ec:d3:80","02:42:c0:bf:ce:ef","02:42:56:67:6a:1f","72:a8:7c:9c:48:1b","aa:a0:a1:65:0c:2a"],"os":{"family":"redhat","platform":"centos","name":"CentOS Linux","version":"7 (Core)","major":7,"minor":6,"patch":1810,"codename":"Core"},"timezone":"GMT","timezone_offset_sec":0,"id":"170eea2c9fb847fbb24a4eae05a40b01"}}}
 7 | 2019-08-20T15:40:12.983Z	INFO	[beat]	instance/beat.go:947	Process info	{"system_info": {"process": {"capabilities": {"inheritable":null,"permitted":["chown","dac_override","dac_read_search","fowner","fsetid","kill","setgid","setuid","setpcap","linux_immutable","net_bind_service","net_broadcast","net_admin","net_raw","ipc_lock","ipc_owner","sys_module","sys_rawio","sys_chroot","sys_ptrace","sys_pacct","sys_admin","sys_boot","sys_nice","sys_resource","sys_time","sys_tty_config","mknod","lease","audit_write","audit_control","setfcap","mac_override","mac_admin","syslog","wake_alarm","block_suspend"],"effective":["chown","dac_override","dac_read_search","fowner","fsetid","kill","setgid","setuid","setpcap","linux_immutable","net_bind_service","net_broadcast","net_admin","net_raw","ipc_lock","ipc_owner","sys_module","sys_rawio","sys_chroot","sys_ptrace","sys_pacct","sys_admin","sys_boot","sys_nice","sys_resource","sys_time","sys_tty_config","mknod","lease","audit_write","audit_control","setfcap","mac_override","mac_admin","syslog","wake_alarm","block_suspend"],"bounding":["chown","dac_override","dac_read_search","fowner","fsetid","kill","setgid","setuid","setpcap","linux_immutable","net_bind_service","net_broadcast","net_admin","net_raw","ipc_lock","ipc_owner","sys_module","sys_rawio","sys_chroot","sys_ptrace","sys_pacct","sys_admin","sys_boot","sys_nice","sys_resource","sys_time","sys_tty_config","mknod","lease","audit_write","audit_control","setfcap","mac_override","mac_admin","syslog","wake_alarm","block_suspend"],"ambient":null}, "cwd": "/go/src/github.com/PhaedrusTheGreek/nagioscheckbeat", "exe": "/go/bin/nagioscheckbeat", "name": "nagioscheckbeat", "pid": 19948, "ppid": 5020, "seccomp": {"mode":"disabled"}, "start_time": "2019-08-20T15:40:12.380Z"}}}
 8 | 2019-08-20T15:40:12.983Z	INFO	instance/beat.go:292	Setup Beat: nagioscheckbeat; Version: 8.0.0
 9 | 2019-08-20T15:40:12.983Z	INFO	[index-management]	idxmgmt/std.go:178	Set output.elasticsearch.index to 'nagioscheckbeat-8.0.0' as ILM is enabled.
10 | 2019-08-20T15:40:12.983Z	INFO	elasticsearch/client.go:170	Elasticsearch url: http://localhost:9200
11 | 2019-08-20T15:40:12.984Z	INFO	[publisher]	pipeline/module.go:97	Beat name: max.layer8ideas.com
12 | 2019-08-20T15:40:12.984Z	INFO	instance/beat.go:421	nagioscheckbeat start running.
13 | 2019-08-20T15:40:12.984Z	INFO	beater/nagioscheckbeat.go:37	nagioscheckbeat is running! Hit CTRL-C to stop it.
14 | 2019-08-20T15:40:12.984Z	INFO	[monitoring]	log/log.go:118	Starting metrics logging every 30s
15 | 2019-08-20T15:40:12.985Z	INFO	check/check.go:67	Starting metric heartbeat with period 10s
16 | 2019-08-20T15:40:14.806Z	INFO	[monitoring]	log/log.go:153	Total non-zero metrics	{"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":20,"time":{"ms":28}},"total":{"ticks":60,"time":{"ms":77},"value":60},"user":{"ticks":40,"time":{"ms":49}}},"handles":{"limit":{"hard":4096,"soft":1024},"open":12},"info":{"ephemeral_id":"1d713e24-8de3-4ced-b5f1-883023ba89e3","uptime":{"ms":1879}},"memstats":{"gc_next":4194304,"memory_alloc":2931800,"memory_total":4918808,"rss":18321408},"runtime":{"goroutines":35}},"libbeat":{"config":{"module":{"running":0}},"output":{"type":"elasticsearch"},"pipeline":{"clients":0,"events":{"active":0}}},"system":{"cpu":{"cores":4},"load":{"1":0.02,"15":0.09,"5":0.07,"norm":{"1":0.005,"15":0.0225,"5":0.0175}}}}}}
17 | 2019-08-20T15:40:14.807Z	INFO	[monitoring]	log/log.go:154	Uptime: 1.882380591s
18 | 2019-08-20T15:40:14.807Z	INFO	[monitoring]	log/log.go:131	Stopping metrics logging.
19 | 2019-08-20T15:40:14.807Z	INFO	instance/beat.go:431	nagioscheckbeat stopped.
20 | 


--------------------------------------------------------------------------------
/magefile.go:
--------------------------------------------------------------------------------
  1 | // Licensed to Elasticsearch B.V. under one or more contributor
  2 | // license agreements. See the NOTICE file distributed with
  3 | // this work for additional information regarding copyright
  4 | // ownership. Elasticsearch B.V. licenses this file to you under
  5 | // the Apache License, Version 2.0 (the "License"); you may
  6 | // not use this file except in compliance with the License.
  7 | // You may obtain a copy of the License at
  8 | //
  9 | //     http://www.apache.org/licenses/LICENSE-2.0
 10 | //
 11 | // Unless required by applicable law or agreed to in writing,
 12 | // software distributed under the License is distributed on an
 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 14 | // KIND, either express or implied.  See the License for the
 15 | // specific language governing permissions and limitations
 16 | // under the License.
 17 | 
 18 | // +build mage
 19 | 
 20 | package main
 21 | 
 22 | import (
 23 | 	"context"
 24 | 	"fmt"
 25 | 	"time"
 26 | 
 27 | 	"github.com/magefile/mage/mg"
 28 | 	"github.com/magefile/mage/sh"
 29 | 
 30 | 	devtools "github.com/elastic/beats/dev-tools/mage"
 31 | )
 32 | 
 33 | func init() {
 34 | 	devtools.SetBuildVariableSources(devtools.DefaultBeatBuildVariableSources)
 35 | 
 36 | 	devtools.BeatDescription = "One sentence description of the Beat."
 37 |         devtools.BeatVendor = "PhaedrusTheGreek"
 38 | }
 39 | 
 40 | // Build builds the Beat binary.
 41 | func Build() error {
 42 | 	return devtools.Build(devtools.DefaultBuildArgs())
 43 | }
 44 | 
 45 | // GolangCrossBuild build the Beat binary inside of the golang-builder.
 46 | // Do not use directly, use crossBuild instead.
 47 | func GolangCrossBuild() error {
 48 | 	return devtools.GolangCrossBuild(devtools.DefaultGolangCrossBuildArgs())
 49 | }
 50 | 
 51 | // BuildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon).
 52 | func BuildGoDaemon() error {
 53 | 	return devtools.BuildGoDaemon()
 54 | }
 55 | 
 56 | // CrossBuild cross-builds the beat for all target platforms.
 57 | func CrossBuild() error {
 58 | 	return devtools.CrossBuild()
 59 | }
 60 | 
 61 | // CrossBuildGoDaemon cross-builds the go-daemon binary using Docker.
 62 | func CrossBuildGoDaemon() error {
 63 | 	return devtools.CrossBuildGoDaemon()
 64 | }
 65 | 
 66 | // Clean cleans all generated files and build artifacts.
 67 | func Clean() error {
 68 | 	return devtools.Clean()
 69 | }
 70 | 
 71 | // Package packages the Beat for distribution.
 72 | // Use SNAPSHOT=true to build snapshots.
 73 | // Use PLATFORMS to control the target platforms.
 74 | func Package() {
 75 | 	start := time.Now()
 76 | 	defer func() { fmt.Println("package ran for", time.Since(start)) }()
 77 | 
 78 | 	devtools.UseCommunityBeatPackaging()
 79 | 
 80 | 	mg.Deps(Update)
 81 | 	mg.Deps(CrossBuild, CrossBuildGoDaemon)
 82 | 	mg.SerialDeps(devtools.Package, TestPackages)
 83 | }
 84 | 
 85 | // TestPackages tests the generated packages (i.e. file modes, owners, groups).
 86 | func TestPackages() error {
 87 | 	return devtools.TestPackages()
 88 | }
 89 | 
 90 | // Update updates the generated files (aka make update).
 91 | func Update() error {
 92 | 	return sh.Run("make", "update")
 93 | }
 94 | 
 95 | // Fields generates a fields.yml for the Beat.
 96 | func Fields() error {
 97 | 	return devtools.GenerateFieldsYAML()
 98 | }
 99 | 
100 | // GoTestUnit executes the Go unit tests.
101 | // Use TEST_COVERAGE=true to enable code coverage profiling.
102 | // Use RACE_DETECTOR=true to enable the race detector.
103 | func GoTestUnit(ctx context.Context) error {
104 | 	return devtools.GoTest(ctx, devtools.DefaultGoTestUnitArgs())
105 | }
106 | 
107 | // GoTestIntegration executes the Go integration tests.
108 | // Use TEST_COVERAGE=true to enable code coverage profiling.
109 | // Use RACE_DETECTOR=true to enable the race detector.
110 | func GoTestIntegration(ctx context.Context) error {
111 | 	return devtools.GoTest(ctx, devtools.DefaultGoTestIntegrationArgs())
112 | }
113 | 
114 | // Config generates both the short/reference/docker configs.
115 | func Config() error {
116 |         return devtools.Config(devtools.AllConfigTypes, devtools.ConfigFileParams{}, ".")
117 | }
118 | 
119 | 


--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
 1 | package main
 2 | 
 3 | import (
 4 | 	"os"
 5 | 
 6 | 	"github.com/PhaedrusTheGreek/nagioscheckbeat/cmd"
 7 | )
 8 | 
 9 | func main() {
10 | 	if err := cmd.RootCmd.Execute(); err != nil {
11 | 		os.Exit(1)
12 | 	}
13 | }
14 | 


--------------------------------------------------------------------------------
/main_test.go:
--------------------------------------------------------------------------------
 1 | package main
 2 | 
 3 | // This file is mandatory as otherwise the nagioscheckbeat.test binary is not generated correctly.
 4 | 
 5 | import (
 6 | 	"flag"
 7 | 	"testing"
 8 | 
 9 | 	"github.com/PhaedrusTheGreek/nagioscheckbeat/cmd"
10 | )
11 | 
12 | var systemTest *bool
13 | 
14 | func init() {
15 | 	systemTest = flag.Bool("systemTest", false, "Set to true when running system tests")
16 | 
17 | 	cmd.RootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("systemTest"))
18 | 	cmd.RootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("test.coverprofile"))
19 | }
20 | 
21 | // Test started when the test binary is started. Only calls main.
22 | func TestSystem(t *testing.T) {
23 | 
24 | 	if *systemTest {
25 | 		main()
26 | 	}
27 | }
28 | 


--------------------------------------------------------------------------------
/make.bat:
--------------------------------------------------------------------------------
 1 | @echo off
 2 | 
 3 | REM Windows wrapper for Mage (https://magefile.org/) that installs it
 4 | REM to %GOPATH%\bin from the Beats vendor directory.
 5 | REM
 6 | REM After running this once you may invoke mage.exe directly.
 7 | 
 8 | WHERE mage
 9 | IF %ERRORLEVEL% NEQ 0 go install github.com/PhaedrusTheGreek/nagioscheckbeat/vendor/github.com/magefile/mage
10 | 
11 | mage %*
12 | 


--------------------------------------------------------------------------------
/nagioscheckbeat-sar-example.yml:
--------------------------------------------------------------------------------
 1 | 
 2 | nagioscheckbeat:
 3 |   checks:
 4 |     -
 5 |       name: "heartbeat"
 6 |       cmd: "/usr/lib64/nagios/plugins/check_dummy"
 7 |       args: "0 Hello"
 8 |     -
 9 |       name: "pagestat"
10 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
11 |       args: "pagestat"
12 |     -
13 |       name: "io"
14 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
15 |       args: "io_transfer"
16 |     -
17 |       name: "memory_util"
18 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
19 |       args: "memory_util"
20 |     -
21 |       name: "kernel"
22 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
23 |       args: "kernel"
24 |     -
25 |       name: "cpu"
26 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
27 |       args: "cpu"
28 |     -
29 |       name: "memory_stat"
30 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
31 |       args: "memory_stat"
32 |     -
33 |       name: "queueln_load"
34 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
35 |       args: "queueln_load"
36 |     -
37 |       name: "swap_util"
38 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
39 |       args: "swap_util"
40 |     -
41 |       name: "swap_stat"
42 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
43 |       args: "swap_stat"
44 |     -
45 |       name: "task"
46 |       cmd: "/usr/lib64/nagios/plugins/check_sar_perf.py"
47 |       args: "task"
48 | 
49 | output.elasticsearch:
50 |   hosts: ["localhost:9200"]


--------------------------------------------------------------------------------
/nagioscheckbeat.docker.yml:
--------------------------------------------------------------------------------
 1 | nagioscheckbeat:
 2 |   period: 1s
 3 | processors:
 4 | - add_cloud_metadata: ~
 5 | - add_docker_metadata: ~
 6 | 
 7 | output.elasticsearch:
 8 |   hosts: '${ELASTICSEARCH_HOSTS:elasticsearch:9200}'
 9 |   username: '${ELASTICSEARCH_USERNAME:}'
10 |   password: '${ELASTICSEARCH_PASSWORD:}'
11 | 


--------------------------------------------------------------------------------
/nagioscheckbeat.osx.yml:
--------------------------------------------------------------------------------
  1 | ################### Nagioscheckbeat Configuration Example #########################
  2 | 
  3 | ############################# Nagioscheckbeat ######################################
  4 | 
  5 | nagioscheckbeat:
  6 |    checks:
  7 |     -
  8 |       name: "heartbeat"
  9 |       cmd: "/usr/local/sbin/check_dummy"
 10 |       args: "0 Hello"
 11 |       period: "1s"
 12 |     -
 13 |       name: "disks"
 14 |       cmd: "/usr/local/sbin/check_disk"
 15 |       args: "-w 80 -c 90"
 16 |     -
 17 |       name: "load"
 18 |       cmd: "/usr/local/sbin/check_load"
 19 |       args: "-w 5 -c 10"
 20 |       period: "10s"
 21 |     -
 22 |       name: "proc"
 23 |       cmd: "/usr/local/sbin/check_procs"
 24 |       period: "10s"
 25 |     -
 26 |       name: "swap"
 27 |       cmd: "/usr/local/sbin/check_swap"
 28 |       args: "-w 90% -c 50%"
 29 |       period: "2m"
 30 | 
 31 | #================================ General =====================================
 32 | 
 33 | # The name of the shipper that publishes the network data. It can be used to group
 34 | # all the transactions sent by a single shipper in the web interface.
 35 | #name:
 36 | 
 37 | # The tags of the shipper are included in their own field with each
 38 | # transaction published.
 39 | #tags: ["service-X", "web-tier"]
 40 | 
 41 | # Optional fields that you can specify to add additional information to the
 42 | # output.
 43 | #fields:
 44 | #  env: staging
 45 | 
 46 | 
 47 | #============================== Dashboards =====================================
 48 | # These settings control loading the sample dashboards to the Kibana index. Loading
 49 | # the dashboards is disabled by default and can be enabled either by setting the
 50 | # options here, or by using the `-setup` CLI flag or the `setup` command.
 51 | #setup.dashboards.enabled: false
 52 | 
 53 | # The URL from where to download the dashboards archive. By default this URL
 54 | # has a value which is computed based on the Beat name and version. For released
 55 | # versions, this URL points to the dashboard archive on the artifacts.elastic.co
 56 | # website.
 57 | #setup.dashboards.url:
 58 | 
 59 | #============================== Kibana =====================================
 60 | 
 61 | # Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
 62 | # This requires a Kibana endpoint configuration.
 63 | setup.kibana:
 64 | 
 65 |   # Kibana Host
 66 |   # Scheme and port can be left out and will be set to the default (http and 5601)
 67 |   # In case you specify and additional path, the scheme is required: http://localhost:5601/path
 68 |   # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
 69 |   #host: "localhost:5601"
 70 | 
 71 | #============================= Elastic Cloud ==================================
 72 | 
 73 | # These settings simplify using nagioscheckbeat with the Elastic Cloud (https://cloud.elastic.co/).
 74 | 
 75 | # The cloud.id setting overwrites the `output.elasticsearch.hosts` and
 76 | # `setup.kibana.host` options.
 77 | # You can find the `cloud.id` in the Elastic Cloud web UI.
 78 | #cloud.id:
 79 | 
 80 | # The cloud.auth setting overwrites the `output.elasticsearch.username` and
 81 | # `output.elasticsearch.password` settings. The format is `:`.
 82 | #cloud.auth:
 83 | 
 84 | #================================ Outputs =====================================
 85 | 
 86 | # Configure what output to use when sending the data collected by the beat.
 87 | 
 88 | #-------------------------- Elasticsearch output ------------------------------
 89 | output.elasticsearch:
 90 |   # Array of hosts to connect to.
 91 |   hosts: ["localhost:9200"]
 92 | 
 93 |   # Optional protocol and basic auth credentials.
 94 |   #protocol: "https"
 95 |   username: "elastic"
 96 |   password: "changeme"
 97 | 
 98 | #----------------------------- Logstash output --------------------------------
 99 | #output.logstash:
100 |   # The Logstash hosts
101 |   #hosts: ["localhost:5044"]
102 | 
103 |   # Optional SSL. By default is off.
104 |   # List of root certificates for HTTPS server verifications
105 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
106 | 
107 |   # Certificate for SSL client authentication
108 |   #ssl.certificate: "/etc/pki/client/cert.pem"
109 | 
110 |   # Client Certificate Key
111 |   #ssl.key: "/etc/pki/client/cert.key"
112 | 
113 | #================================ Logging =====================================
114 | 
115 | # Sets log level. The default log level is info.
116 | # Available log levels are: error, warning, info, debug
117 | #logging.level: debug
118 | 
119 | # At debug level, you can selectively enable logging only for some components.
120 | # To enable all selectors use ["*"]. Examples of other selectors are "beat",
121 | # "publish", "service".
122 | #logging.selectors: ["*"]
123 | 
124 | #============================== Xpack Monitoring ===============================
125 | # nagioscheckbeat can export internal metrics to a central Elasticsearch monitoring
126 | # cluster.  This requires xpack monitoring to be enabled in Elasticsearch.  The
127 | # reporting is disabled by default.
128 | 
129 | # Set to true to enable the monitoring reporter.
130 | #xpack.monitoring.enabled: false
131 | 
132 | # Uncomment to send the metrics to Elasticsearch. Most settings from the
133 | # Elasticsearch output are accepted here as well. Any setting that is not set is
134 | # automatically inherited from the Elasticsearch output configuration, so if you
135 | # have the Elasticsearch output configured, you can simply uncomment the
136 | # following line.
137 | #xpack.monitoring.elasticsearch:
138 | 


--------------------------------------------------------------------------------
/nagioscheckbeat.reference.yml:
--------------------------------------------------------------------------------
   1 | 
   2 | #================================ General ======================================
   3 | 
   4 | # The name of the shipper that publishes the network data. It can be used to group
   5 | # all the transactions sent by a single shipper in the web interface.
   6 | # If this options is not defined, the hostname is used.
   7 | #name:
   8 | 
   9 | # The tags of the shipper are included in their own field with each
  10 | # transaction published. Tags make it easy to group servers by different
  11 | # logical properties.
  12 | #tags: ["service-X", "web-tier"]
  13 | 
  14 | # Optional fields that you can specify to add additional information to the
  15 | # output. Fields can be scalar values, arrays, dictionaries, or any nested
  16 | # combination of these.
  17 | #fields:
  18 | #  env: staging
  19 | 
  20 | # If this option is set to true, the custom fields are stored as top-level
  21 | # fields in the output document instead of being grouped under a fields
  22 | # sub-dictionary. Default is false.
  23 | #fields_under_root: false
  24 | 
  25 | # Internal queue configuration for buffering events to be published.
  26 | #queue:
  27 |   # Queue type by name (default 'mem')
  28 |   # The memory queue will present all available events (up to the outputs
  29 |   # bulk_max_size) to the output, the moment the output is ready to server
  30 |   # another batch of events.
  31 |   #mem:
  32 |     # Max number of events the queue can buffer.
  33 |     #events: 4096
  34 | 
  35 |     # Hints the minimum number of events stored in the queue,
  36 |     # before providing a batch of events to the outputs.
  37 |     # The default value is set to 2048.
  38 |     # A value of 0 ensures events are immediately available
  39 |     # to be sent to the outputs.
  40 |     #flush.min_events: 2048
  41 | 
  42 |     # Maximum duration after which events are available to the outputs,
  43 |     # if the number of events stored in the queue is < `flush.min_events`.
  44 |     #flush.timeout: 1s
  45 | 
  46 |   # The spool queue will store events in a local spool file, before
  47 |   # forwarding the events to the outputs.
  48 |   #
  49 |   # Beta: spooling to disk is currently a beta feature. Use with care.
  50 |   #
  51 |   # The spool file is a circular buffer, which blocks once the file/buffer is full.
  52 |   # Events are put into a write buffer and flushed once the write buffer
  53 |   # is full or the flush_timeout is triggered.
  54 |   # Once ACKed by the output, events are removed immediately from the queue,
  55 |   # making space for new events to be persisted.
  56 |   #spool:
  57 |     # The file namespace configures the file path and the file creation settings.
  58 |     # Once the file exists, the `size`, `page_size` and `prealloc` settings
  59 |     # will have no more effect.
  60 |     #file:
  61 |       # Location of spool file. The default value is ${path.data}/spool.dat.
  62 |       #path: "${path.data}/spool.dat"
  63 | 
  64 |       # Configure file permissions if file is created. The default value is 0600.
  65 |       #permissions: 0600
  66 | 
  67 |       # File size hint. The spool blocks, once this limit is reached. The default value is 100 MiB.
  68 |       #size: 100MiB
  69 | 
  70 |       # The files page size. A file is split into multiple pages of the same size. The default value is 4KiB.
  71 |       #page_size: 4KiB
  72 | 
  73 |       # If prealloc is set, the required space for the file is reserved using
  74 |       # truncate. The default value is true.
  75 |       #prealloc: true
  76 | 
  77 |     # Spool writer settings
  78 |     # Events are serialized into a write buffer. The write buffer is flushed if:
  79 |     # - The buffer limit has been reached.
  80 |     # - The configured limit of buffered events is reached.
  81 |     # - The flush timeout is triggered.
  82 |     #write:
  83 |       # Sets the write buffer size.
  84 |       #buffer_size: 1MiB
  85 | 
  86 |       # Maximum duration after which events are flushed if the write buffer
  87 |       # is not full yet. The default value is 1s.
  88 |       #flush.timeout: 1s
  89 | 
  90 |       # Number of maximum buffered events. The write buffer is flushed once the
  91 |       # limit is reached.
  92 |       #flush.events: 16384
  93 | 
  94 |       # Configure the on-disk event encoding. The encoding can be changed
  95 |       # between restarts.
  96 |       # Valid encodings are: json, ubjson, and cbor.
  97 |       #codec: cbor
  98 |     #read:
  99 |       # Reader flush timeout, waiting for more events to become available, so
 100 |       # to fill a complete batch as required by the outputs.
 101 |       # If flush_timeout is 0, all available events are forwarded to the
 102 |       # outputs immediately.
 103 |       # The default value is 0s.
 104 |       #flush.timeout: 0s
 105 | 
 106 | # Sets the maximum number of CPUs that can be executing simultaneously. The
 107 | # default is the number of logical CPUs available in the system.
 108 | #max_procs:
 109 | 
 110 | #================================ Processors ===================================
 111 | 
 112 | # Processors are used to reduce the number of fields in the exported event or to
 113 | # enhance the event with external metadata. This section defines a list of
 114 | # processors that are applied one by one and the first one receives the initial
 115 | # event:
 116 | #
 117 | #   event -> filter1 -> event1 -> filter2 ->event2 ...
 118 | #
 119 | # The supported processors are drop_fields, drop_event, include_fields,
 120 | # decode_json_fields, and add_cloud_metadata.
 121 | #
 122 | # For example, you can use the following processors to keep the fields that
 123 | # contain CPU load percentages, but remove the fields that contain CPU ticks
 124 | # values:
 125 | #
 126 | #processors:
 127 | #- include_fields:
 128 | #    fields: ["cpu"]
 129 | #- drop_fields:
 130 | #    fields: ["cpu.user", "cpu.system"]
 131 | #
 132 | # The following example drops the events that have the HTTP response code 200:
 133 | #
 134 | #processors:
 135 | #- drop_event:
 136 | #    when:
 137 | #       equals:
 138 | #           http.code: 200
 139 | #
 140 | # The following example renames the field a to b:
 141 | #
 142 | #processors:
 143 | #- rename:
 144 | #    fields:
 145 | #       - from: "a"
 146 | #         to: "b"
 147 | #
 148 | # The following example tokenizes the string into fields:
 149 | #
 150 | #processors:
 151 | #- dissect:
 152 | #    tokenizer: "%{key1} - %{key2}"
 153 | #    field: "message"
 154 | #    target_prefix: "dissect"
 155 | #
 156 | # The following example enriches each event with metadata from the cloud
 157 | # provider about the host machine. It works on EC2, GCE, DigitalOcean,
 158 | # Tencent Cloud, and Alibaba Cloud.
 159 | #
 160 | #processors:
 161 | #- add_cloud_metadata: ~
 162 | #
 163 | # The following example enriches each event with the machine's local time zone
 164 | # offset from UTC.
 165 | #
 166 | #processors:
 167 | #- add_locale:
 168 | #    format: offset
 169 | #
 170 | # The following example enriches each event with docker metadata, it matches
 171 | # given fields to an existing container id and adds info from that container:
 172 | #
 173 | #processors:
 174 | #- add_docker_metadata:
 175 | #    host: "unix:///var/run/docker.sock"
 176 | #    match_fields: ["system.process.cgroup.id"]
 177 | #    match_pids: ["process.pid", "process.ppid"]
 178 | #    match_source: true
 179 | #    match_source_index: 4
 180 | #    match_short_id: false
 181 | #    cleanup_timeout: 60
 182 | #    labels.dedot: false
 183 | #    # To connect to Docker over TLS you must specify a client and CA certificate.
 184 | #    #ssl:
 185 | #    #  certificate_authority: "/etc/pki/root/ca.pem"
 186 | #    #  certificate:           "/etc/pki/client/cert.pem"
 187 | #    #  key:                   "/etc/pki/client/cert.key"
 188 | #
 189 | # The following example enriches each event with docker metadata, it matches
 190 | # container id from log path available in `source` field (by default it expects
 191 | # it to be /var/lib/docker/containers/*/*.log).
 192 | #
 193 | #processors:
 194 | #- add_docker_metadata: ~
 195 | #
 196 | # The following example enriches each event with host metadata.
 197 | #
 198 | #processors:
 199 | #- add_host_metadata:
 200 | #   netinfo.enabled: false
 201 | #
 202 | # The following example enriches each event with process metadata using
 203 | # process IDs included in the event.
 204 | #
 205 | #processors:
 206 | #- add_process_metadata:
 207 | #    match_pids: ["system.process.ppid"]
 208 | #    target: system.process.parent
 209 | #
 210 | # The following example decodes fields containing JSON strings
 211 | # and replaces the strings with valid JSON objects.
 212 | #
 213 | #processors:
 214 | #- decode_json_fields:
 215 | #    fields: ["field1", "field2", ...]
 216 | #    process_array: false
 217 | #    max_depth: 1
 218 | #    target: ""
 219 | #    overwrite_keys: false
 220 | #
 221 | #processors:
 222 | #- decompress_gzip_field:
 223 | #    from: "field1"
 224 | #    to: "field2"
 225 | #    ignore_missing: false
 226 | #    fail_on_error: true
 227 | #
 228 | # The following example copies the value of message to message_copied
 229 | #
 230 | #processors:
 231 | #- copy_fields:
 232 | #    fields:
 233 | #        - from: message
 234 | #          to: message_copied
 235 | #    fail_on_error: true
 236 | #    ignore_missing: false
 237 | #
 238 | # The following example truncates the value of message to 1024 bytes
 239 | #
 240 | #processors:
 241 | #- truncate_fields:
 242 | #    fields:
 243 | #      - message
 244 | #    max_bytes: 1024
 245 | #    fail_on_error: false
 246 | #    ignore_missing: true
 247 | #
 248 | # The following example preserves the raw message under event.original
 249 | #
 250 | #processors:
 251 | #- copy_fields:
 252 | #    fields:
 253 | #        - from: message
 254 | #          to: event.original
 255 | #    fail_on_error: false
 256 | #    ignore_missing: true
 257 | #- truncate_fields:
 258 | #    fields:
 259 | #      - event.original
 260 | #    max_bytes: 1024
 261 | #    fail_on_error: false
 262 | #    ignore_missing: true
 263 | 
 264 | #============================= Elastic Cloud ==================================
 265 | 
 266 | # These settings simplify using Nagioscheckbeat with the Elastic Cloud (https://cloud.elastic.co/).
 267 | 
 268 | # The cloud.id setting overwrites the `output.elasticsearch.hosts` and
 269 | # `setup.kibana.host` options.
 270 | # You can find the `cloud.id` in the Elastic Cloud web UI.
 271 | #cloud.id:
 272 | 
 273 | # The cloud.auth setting overwrites the `output.elasticsearch.username` and
 274 | # `output.elasticsearch.password` settings. The format is `:`.
 275 | #cloud.auth:
 276 | 
 277 | #================================ Outputs ======================================
 278 | 
 279 | # Configure what output to use when sending the data collected by the beat.
 280 | 
 281 | #-------------------------- Elasticsearch output -------------------------------
 282 | output.elasticsearch:
 283 |   # Boolean flag to enable or disable the output module.
 284 |   #enabled: true
 285 | 
 286 |   # Array of hosts to connect to.
 287 |   # Scheme and port can be left out and will be set to the default (http and 9200)
 288 |   # In case you specify and additional path, the scheme is required: http://localhost:9200/path
 289 |   # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
 290 |   hosts: ["localhost:9200"]
 291 | 
 292 |   # Set gzip compression level.
 293 |   #compression_level: 0
 294 | 
 295 |   # Configure escaping HTML symbols in strings.
 296 |   #escape_html: false
 297 | 
 298 |   # Protocol - either `http` (default) or `https`.
 299 |   #protocol: "https"
 300 | 
 301 |   # Authentication credentials - either API key or username/password.
 302 |   #api_key: "id:api_key"
 303 |   #username: "elastic"
 304 |   #password: "changeme"
 305 | 
 306 |   # Dictionary of HTTP parameters to pass within the URL with index operations.
 307 |   #parameters:
 308 |     #param1: value1
 309 |     #param2: value2
 310 | 
 311 |   # Number of workers per Elasticsearch host.
 312 |   #worker: 1
 313 | 
 314 |   # Optional index name. The default is "nagioscheckbeat" plus date
 315 |   # and generates [nagioscheckbeat-]YYYY.MM.DD keys.
 316 |   # In case you modify this pattern you must update setup.template.name and setup.template.pattern accordingly.
 317 |   #index: "nagioscheckbeat-%{[agent.version]}-%{+yyyy.MM.dd}"
 318 | 
 319 |   # Optional ingest node pipeline. By default no pipeline will be used.
 320 |   #pipeline: ""
 321 | 
 322 |   # Optional HTTP path
 323 |   #path: "/elasticsearch"
 324 | 
 325 |   # Custom HTTP headers to add to each request
 326 |   #headers:
 327 |   #  X-My-Header: Contents of the header
 328 | 
 329 |   # Proxy server URL
 330 |   #proxy_url: http://proxy:3128
 331 | 
 332 |   # Whether to disable proxy settings for outgoing connections. If true, this
 333 |   # takes precedence over both the proxy_url field and any environment settings
 334 |   # (HTTP_PROXY, HTTPS_PROXY). The default is false.
 335 |   #proxy_disable: false
 336 | 
 337 |   # The number of times a particular Elasticsearch index operation is attempted. If
 338 |   # the indexing operation doesn't succeed after this many retries, the events are
 339 |   # dropped. The default is 3.
 340 |   #max_retries: 3
 341 | 
 342 |   # The maximum number of events to bulk in a single Elasticsearch bulk API index request.
 343 |   # The default is 50.
 344 |   #bulk_max_size: 50
 345 | 
 346 |   # The number of seconds to wait before trying to reconnect to Elasticsearch
 347 |   # after a network error. After waiting backoff.init seconds, the Beat
 348 |   # tries to reconnect. If the attempt fails, the backoff timer is increased
 349 |   # exponentially up to backoff.max. After a successful connection, the backoff
 350 |   # timer is reset. The default is 1s.
 351 |   #backoff.init: 1s
 352 | 
 353 |   # The maximum number of seconds to wait before attempting to connect to
 354 |   # Elasticsearch after a network error. The default is 60s.
 355 |   #backoff.max: 60s
 356 | 
 357 |   # Configure HTTP request timeout before failing a request to Elasticsearch.
 358 |   #timeout: 90
 359 | 
 360 |   # Use SSL settings for HTTPS.
 361 |   #ssl.enabled: true
 362 | 
 363 |   # Configure SSL verification mode. If `none` is configured, all server hosts
 364 |   # and certificates will be accepted. In this mode, SSL-based connections are
 365 |   # susceptible to man-in-the-middle attacks. Use only for testing. Default is
 366 |   # `full`.
 367 |   #ssl.verification_mode: full
 368 | 
 369 |   # List of supported/valid TLS versions. By default all TLS versions from 1.0 up to
 370 |   # 1.2 are enabled.
 371 |   #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]
 372 | 
 373 |   # List of root certificates for HTTPS server verifications
 374 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
 375 | 
 376 |   # Certificate for SSL client authentication
 377 |   #ssl.certificate: "/etc/pki/client/cert.pem"
 378 | 
 379 |   # Client certificate key
 380 |   #ssl.key: "/etc/pki/client/cert.key"
 381 | 
 382 |   # Optional passphrase for decrypting the certificate key.
 383 |   #ssl.key_passphrase: ''
 384 | 
 385 |   # Configure cipher suites to be used for SSL connections
 386 |   #ssl.cipher_suites: []
 387 | 
 388 |   # Configure curve types for ECDHE-based cipher suites
 389 |   #ssl.curve_types: []
 390 | 
 391 |   # Configure what types of renegotiation are supported. Valid options are
 392 |   # never, once, and freely. Default is never.
 393 |   #ssl.renegotiation: never
 394 | 
 395 | #----------------------------- Logstash output ---------------------------------
 396 | #output.logstash:
 397 |   # Boolean flag to enable or disable the output module.
 398 |   #enabled: true
 399 | 
 400 |   # The Logstash hosts
 401 |   #hosts: ["localhost:5044"]
 402 | 
 403 |   # Number of workers per Logstash host.
 404 |   #worker: 1
 405 | 
 406 |   # Set gzip compression level.
 407 |   #compression_level: 3
 408 | 
 409 |   # Configure escaping HTML symbols in strings.
 410 |   #escape_html: false
 411 | 
 412 |   # Optional maximum time to live for a connection to Logstash, after which the
 413 |   # connection will be re-established.  A value of `0s` (the default) will
 414 |   # disable this feature.
 415 |   #
 416 |   # Not yet supported for async connections (i.e. with the "pipelining" option set)
 417 |   #ttl: 30s
 418 | 
 419 |   # Optionally load-balance events between Logstash hosts. Default is false.
 420 |   #loadbalance: false
 421 | 
 422 |   # Number of batches to be sent asynchronously to Logstash while processing
 423 |   # new batches.
 424 |   #pipelining: 2
 425 | 
 426 |   # If enabled only a subset of events in a batch of events is transferred per
 427 |   # transaction.  The number of events to be sent increases up to `bulk_max_size`
 428 |   # if no error is encountered.
 429 |   #slow_start: false
 430 | 
 431 |   # The number of seconds to wait before trying to reconnect to Logstash
 432 |   # after a network error. After waiting backoff.init seconds, the Beat
 433 |   # tries to reconnect. If the attempt fails, the backoff timer is increased
 434 |   # exponentially up to backoff.max. After a successful connection, the backoff
 435 |   # timer is reset. The default is 1s.
 436 |   #backoff.init: 1s
 437 | 
 438 |   # The maximum number of seconds to wait before attempting to connect to
 439 |   # Logstash after a network error. The default is 60s.
 440 |   #backoff.max: 60s
 441 | 
 442 |   # Optional index name. The default index name is set to nagioscheckbeat
 443 |   # in all lowercase.
 444 |   #index: 'nagioscheckbeat'
 445 | 
 446 |   # SOCKS5 proxy server URL
 447 |   #proxy_url: socks5://user:password@socks5-server:2233
 448 | 
 449 |   # Resolve names locally when using a proxy server. Defaults to false.
 450 |   #proxy_use_local_resolver: false
 451 | 
 452 |   # Enable SSL support. SSL is automatically enabled if any SSL setting is set.
 453 |   #ssl.enabled: true
 454 | 
 455 |   # Configure SSL verification mode. If `none` is configured, all server hosts
 456 |   # and certificates will be accepted. In this mode, SSL based connections are
 457 |   # susceptible to man-in-the-middle attacks. Use only for testing. Default is
 458 |   # `full`.
 459 |   #ssl.verification_mode: full
 460 | 
 461 |   # List of supported/valid TLS versions. By default all TLS versions from 1.0 up to
 462 |   # 1.2 are enabled.
 463 |   #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]
 464 | 
 465 |   # Optional SSL configuration options. SSL is off by default.
 466 |   # List of root certificates for HTTPS server verifications
 467 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
 468 | 
 469 |   # Certificate for SSL client authentication
 470 |   #ssl.certificate: "/etc/pki/client/cert.pem"
 471 | 
 472 |   # Client certificate key
 473 |   #ssl.key: "/etc/pki/client/cert.key"
 474 | 
 475 |   # Optional passphrase for decrypting the Certificate Key.
 476 |   #ssl.key_passphrase: ''
 477 | 
 478 |   # Configure cipher suites to be used for SSL connections
 479 |   #ssl.cipher_suites: []
 480 | 
 481 |   # Configure curve types for ECDHE-based cipher suites
 482 |   #ssl.curve_types: []
 483 | 
 484 |   # Configure what types of renegotiation are supported. Valid options are
 485 |   # never, once, and freely. Default is never.
 486 |   #ssl.renegotiation: never
 487 | 
 488 |   # The number of times to retry publishing an event after a publishing failure.
 489 |   # After the specified number of retries, the events are typically dropped.
 490 |   # Some Beats, such as Filebeat and Winlogbeat, ignore the max_retries setting
 491 |   # and retry until all events are published.  Set max_retries to a value less
 492 |   # than 0 to retry until all events are published. The default is 3.
 493 |   #max_retries: 3
 494 | 
 495 |   # The maximum number of events to bulk in a single Logstash request. The
 496 |   # default is 2048.
 497 |   #bulk_max_size: 2048
 498 | 
 499 |   # The number of seconds to wait for responses from the Logstash server before
 500 |   # timing out. The default is 30s.
 501 |   #timeout: 30s
 502 | 
 503 | #------------------------------- Kafka output ----------------------------------
 504 | #output.kafka:
 505 |   # Boolean flag to enable or disable the output module.
 506 |   #enabled: true
 507 | 
 508 |   # The list of Kafka broker addresses from which to fetch the cluster metadata.
 509 |   # The cluster metadata contain the actual Kafka brokers events are published
 510 |   # to.
 511 |   #hosts: ["localhost:9092"]
 512 | 
 513 |   # The Kafka topic used for produced events. The setting can be a format string
 514 |   # using any event field. To set the topic from document type use `%{[type]}`.
 515 |   #topic: beats
 516 | 
 517 |   # The Kafka event key setting. Use format string to create a unique event key.
 518 |   # By default no event key will be generated.
 519 |   #key: ''
 520 | 
 521 |   # The Kafka event partitioning strategy. Default hashing strategy is `hash`
 522 |   # using the `output.kafka.key` setting or randomly distributes events if
 523 |   # `output.kafka.key` is not configured.
 524 |   #partition.hash:
 525 |     # If enabled, events will only be published to partitions with reachable
 526 |     # leaders. Default is false.
 527 |     #reachable_only: false
 528 | 
 529 |     # Configure alternative event field names used to compute the hash value.
 530 |     # If empty `output.kafka.key` setting will be used.
 531 |     # Default value is empty list.
 532 |     #hash: []
 533 | 
 534 |   # Authentication details. Password is required if username is set.
 535 |   #username: ''
 536 |   #password: ''
 537 | 
 538 |   # Kafka version Nagioscheckbeat is assumed to run against. Defaults to the "1.0.0".
 539 |   #version: '1.0.0'
 540 | 
 541 |   # Configure JSON encoding
 542 |   #codec.json:
 543 |     # Pretty-print JSON event
 544 |     #pretty: false
 545 | 
 546 |     # Configure escaping HTML symbols in strings.
 547 |     #escape_html: false
 548 | 
 549 |   # Metadata update configuration. Metadata contains leader information
 550 |   # used to decide which broker to use when publishing.
 551 |   #metadata:
 552 |     # Max metadata request retry attempts when cluster is in middle of leader
 553 |     # election. Defaults to 3 retries.
 554 |     #retry.max: 3
 555 | 
 556 |     # Wait time between retries during leader elections. Default is 250ms.
 557 |     #retry.backoff: 250ms
 558 | 
 559 |     # Refresh metadata interval. Defaults to every 10 minutes.
 560 |     #refresh_frequency: 10m
 561 | 
 562 |     # Strategy for fetching the topics metadata from the broker. Default is false.
 563 |     #full: false
 564 | 
 565 |   # The number of concurrent load-balanced Kafka output workers.
 566 |   #worker: 1
 567 | 
 568 |   # The number of times to retry publishing an event after a publishing failure.
 569 |   # After the specified number of retries, events are typically dropped.
 570 |   # Some Beats, such as Filebeat, ignore the max_retries setting and retry until
 571 |   # all events are published.  Set max_retries to a value less than 0 to retry
 572 |   # until all events are published. The default is 3.
 573 |   #max_retries: 3
 574 | 
 575 |   # The maximum number of events to bulk in a single Kafka request. The default
 576 |   # is 2048.
 577 |   #bulk_max_size: 2048
 578 | 
 579 |   # Duration to wait before sending bulk Kafka request. 0 is no delay. The default
 580 |   # is 0.
 581 |   #bulk_flush_frequency: 0s
 582 | 
 583 |   # The number of seconds to wait for responses from the Kafka brokers before
 584 |   # timing out. The default is 30s.
 585 |   #timeout: 30s
 586 | 
 587 |   # The maximum duration a broker will wait for number of required ACKs. The
 588 |   # default is 10s.
 589 |   #broker_timeout: 10s
 590 | 
 591 |   # The number of messages buffered for each Kafka broker. The default is 256.
 592 |   #channel_buffer_size: 256
 593 | 
 594 |   # The keep-alive period for an active network connection. If 0s, keep-alives
 595 |   # are disabled. The default is 0 seconds.
 596 |   #keep_alive: 0
 597 | 
 598 |   # Sets the output compression codec. Must be one of none, snappy and gzip. The
 599 |   # default is gzip.
 600 |   #compression: gzip
 601 | 
 602 |   # Set the compression level. Currently only gzip provides a compression level
 603 |   # between 0 and 9. The default value is chosen by the compression algorithm.
 604 |   #compression_level: 4
 605 | 
 606 |   # The maximum permitted size of JSON-encoded messages. Bigger messages will be
 607 |   # dropped. The default value is 1000000 (bytes). This value should be equal to
 608 |   # or less than the broker's message.max.bytes.
 609 |   #max_message_bytes: 1000000
 610 | 
 611 |   # The ACK reliability level required from broker. 0=no response, 1=wait for
 612 |   # local commit, -1=wait for all replicas to commit. The default is 1.  Note:
 613 |   # If set to 0, no ACKs are returned by Kafka. Messages might be lost silently
 614 |   # on error.
 615 |   #required_acks: 1
 616 | 
 617 |   # The configurable ClientID used for logging, debugging, and auditing
 618 |   # purposes.  The default is "beats".
 619 |   #client_id: beats
 620 | 
 621 |   # Enable SSL support. SSL is automatically enabled if any SSL setting is set.
 622 |   #ssl.enabled: true
 623 | 
 624 |   # Optional SSL configuration options. SSL is off by default.
 625 |   # List of root certificates for HTTPS server verifications
 626 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
 627 | 
 628 |   # Configure SSL verification mode. If `none` is configured, all server hosts
 629 |   # and certificates will be accepted. In this mode, SSL based connections are
 630 |   # susceptible to man-in-the-middle attacks. Use only for testing. Default is
 631 |   # `full`.
 632 |   #ssl.verification_mode: full
 633 | 
 634 |   # List of supported/valid TLS versions. By default all TLS versions from 1.0 up to
 635 |   # 1.2 are enabled.
 636 |   #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]
 637 | 
 638 |   # Certificate for SSL client authentication
 639 |   #ssl.certificate: "/etc/pki/client/cert.pem"
 640 | 
 641 |   # Client Certificate Key
 642 |   #ssl.key: "/etc/pki/client/cert.key"
 643 | 
 644 |   # Optional passphrase for decrypting the Certificate Key.
 645 |   #ssl.key_passphrase: ''
 646 | 
 647 |   # Configure cipher suites to be used for SSL connections
 648 |   #ssl.cipher_suites: []
 649 | 
 650 |   # Configure curve types for ECDHE-based cipher suites
 651 |   #ssl.curve_types: []
 652 | 
 653 |   # Configure what types of renegotiation are supported. Valid options are
 654 |   # never, once, and freely. Default is never.
 655 |   #ssl.renegotiation: never
 656 | 
 657 | #------------------------------- Redis output ----------------------------------
 658 | #output.redis:
 659 |   # Boolean flag to enable or disable the output module.
 660 |   #enabled: true
 661 | 
 662 |   # Configure JSON encoding
 663 |   #codec.json:
 664 |     # Pretty print json event
 665 |     #pretty: false
 666 | 
 667 |     # Configure escaping HTML symbols in strings.
 668 |     #escape_html: false
 669 | 
 670 |   # The list of Redis servers to connect to. If load-balancing is enabled, the
 671 |   # events are distributed to the servers in the list. If one server becomes
 672 |   # unreachable, the events are distributed to the reachable servers only.
 673 |   #hosts: ["localhost:6379"]
 674 | 
 675 |   # The name of the Redis list or channel the events are published to. The
 676 |   # default is nagioscheckbeat.
 677 |   #key: nagioscheckbeat
 678 | 
 679 |   # The password to authenticate to Redis with. The default is no authentication.
 680 |   #password:
 681 | 
 682 |   # The Redis database number where the events are published. The default is 0.
 683 |   #db: 0
 684 | 
 685 |   # The Redis data type to use for publishing events. If the data type is list,
 686 |   # the Redis RPUSH command is used. If the data type is channel, the Redis
 687 |   # PUBLISH command is used. The default value is list.
 688 |   #datatype: list
 689 | 
 690 |   # The number of workers to use for each host configured to publish events to
 691 |   # Redis. Use this setting along with the loadbalance option. For example, if
 692 |   # you have 2 hosts and 3 workers, in total 6 workers are started (3 for each
 693 |   # host).
 694 |   #worker: 1
 695 | 
 696 |   # If set to true and multiple hosts or workers are configured, the output
 697 |   # plugin load balances published events onto all Redis hosts. If set to false,
 698 |   # the output plugin sends all events to only one host (determined at random)
 699 |   # and will switch to another host if the currently selected one becomes
 700 |   # unreachable. The default value is true.
 701 |   #loadbalance: true
 702 | 
 703 |   # The Redis connection timeout in seconds. The default is 5 seconds.
 704 |   #timeout: 5s
 705 | 
 706 |   # The number of times to retry publishing an event after a publishing failure.
 707 |   # After the specified number of retries, the events are typically dropped.
 708 |   # Some Beats, such as Filebeat, ignore the max_retries setting and retry until
 709 |   # all events are published. Set max_retries to a value less than 0 to retry
 710 |   # until all events are published. The default is 3.
 711 |   #max_retries: 3
 712 | 
 713 |   # The number of seconds to wait before trying to reconnect to Redis
 714 |   # after a network error. After waiting backoff.init seconds, the Beat
 715 |   # tries to reconnect. If the attempt fails, the backoff timer is increased
 716 |   # exponentially up to backoff.max. After a successful connection, the backoff
 717 |   # timer is reset. The default is 1s.
 718 |   #backoff.init: 1s
 719 | 
 720 |   # The maximum number of seconds to wait before attempting to connect to
 721 |   # Redis after a network error. The default is 60s.
 722 |   #backoff.max: 60s
 723 | 
 724 |   # The maximum number of events to bulk in a single Redis request or pipeline.
 725 |   # The default is 2048.
 726 |   #bulk_max_size: 2048
 727 | 
 728 |   # The URL of the SOCKS5 proxy to use when connecting to the Redis servers. The
 729 |   # value must be a URL with a scheme of socks5://.
 730 |   #proxy_url:
 731 | 
 732 |   # This option determines whether Redis hostnames are resolved locally when
 733 |   # using a proxy. The default value is false, which means that name resolution
 734 |   # occurs on the proxy server.
 735 |   #proxy_use_local_resolver: false
 736 | 
 737 |   # Enable SSL support. SSL is automatically enabled, if any SSL setting is set.
 738 |   #ssl.enabled: true
 739 | 
 740 |   # Configure SSL verification mode. If `none` is configured, all server hosts
 741 |   # and certificates will be accepted. In this mode, SSL based connections are
 742 |   # susceptible to man-in-the-middle attacks. Use only for testing. Default is
 743 |   # `full`.
 744 |   #ssl.verification_mode: full
 745 | 
 746 |   # List of supported/valid TLS versions. By default all TLS versions 1.0 up to
 747 |   # 1.2 are enabled.
 748 |   #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]
 749 | 
 750 |   # Optional SSL configuration options. SSL is off by default.
 751 |   # List of root certificates for HTTPS server verifications
 752 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
 753 | 
 754 |   # Certificate for SSL client authentication
 755 |   #ssl.certificate: "/etc/pki/client/cert.pem"
 756 | 
 757 |   # Client Certificate Key
 758 |   #ssl.key: "/etc/pki/client/cert.key"
 759 | 
 760 |   # Optional passphrase for decrypting the Certificate Key.
 761 |   #ssl.key_passphrase: ''
 762 | 
 763 |   # Configure cipher suites to be used for SSL connections
 764 |   #ssl.cipher_suites: []
 765 | 
 766 |   # Configure curve types for ECDHE based cipher suites
 767 |   #ssl.curve_types: []
 768 | 
 769 |   # Configure what types of renegotiation are supported. Valid options are
 770 |   # never, once, and freely. Default is never.
 771 |   #ssl.renegotiation: never
 772 | 
 773 | #------------------------------- File output -----------------------------------
 774 | #output.file:
 775 |   # Boolean flag to enable or disable the output module.
 776 |   #enabled: true
 777 | 
 778 |   # Configure JSON encoding
 779 |   #codec.json:
 780 |     # Pretty-print JSON event
 781 |     #pretty: false
 782 | 
 783 |     # Configure escaping HTML symbols in strings.
 784 |     #escape_html: false
 785 | 
 786 |   # Path to the directory where to save the generated files. The option is
 787 |   # mandatory.
 788 |   #path: "/tmp/nagioscheckbeat"
 789 | 
 790 |   # Name of the generated files. The default is `nagioscheckbeat` and it generates
 791 |   # files: `nagioscheckbeat`, `nagioscheckbeat.1`, `nagioscheckbeat.2`, etc.
 792 |   #filename: nagioscheckbeat
 793 | 
 794 |   # Maximum size in kilobytes of each file. When this size is reached, and on
 795 |   # every Nagioscheckbeat restart, the files are rotated. The default value is 10240
 796 |   # kB.
 797 |   #rotate_every_kb: 10000
 798 | 
 799 |   # Maximum number of files under path. When this number of files is reached,
 800 |   # the oldest file is deleted and the rest are shifted from last to first. The
 801 |   # default is 7 files.
 802 |   #number_of_files: 7
 803 | 
 804 |   # Permissions to use for file creation. The default is 0600.
 805 |   #permissions: 0600
 806 | 
 807 | #----------------------------- Console output ---------------------------------
 808 | #output.console:
 809 |   # Boolean flag to enable or disable the output module.
 810 |   #enabled: true
 811 | 
 812 |   # Configure JSON encoding
 813 |   #codec.json:
 814 |     # Pretty-print JSON event
 815 |     #pretty: false
 816 | 
 817 |     # Configure escaping HTML symbols in strings.
 818 |     #escape_html: false
 819 | 
 820 | #================================= Paths ======================================
 821 | 
 822 | # The home path for the Nagioscheckbeat installation. This is the default base path
 823 | # for all other path settings and for miscellaneous files that come with the
 824 | # distribution (for example, the sample dashboards).
 825 | # If not set by a CLI flag or in the configuration file, the default for the
 826 | # home path is the location of the binary.
 827 | #path.home:
 828 | 
 829 | # The configuration path for the Nagioscheckbeat installation. This is the default
 830 | # base path for configuration files, including the main YAML configuration file
 831 | # and the Elasticsearch template file. If not set by a CLI flag or in the
 832 | # configuration file, the default for the configuration path is the home path.
 833 | #path.config: ${path.home}
 834 | 
 835 | # The data path for the Nagioscheckbeat installation. This is the default base path
 836 | # for all the files in which Nagioscheckbeat needs to store its data. If not set by a
 837 | # CLI flag or in the configuration file, the default for the data path is a data
 838 | # subdirectory inside the home path.
 839 | #path.data: ${path.home}/data
 840 | 
 841 | # The logs path for a Nagioscheckbeat installation. This is the default location for
 842 | # the Beat's log files. If not set by a CLI flag or in the configuration file,
 843 | # the default for the logs path is a logs subdirectory inside the home path.
 844 | #path.logs: ${path.home}/logs
 845 | 
 846 | #================================ Keystore ==========================================
 847 | # Location of the Keystore containing the keys and their sensitive values.
 848 | #keystore.path: "${path.config}/beats.keystore"
 849 | 
 850 | #============================== Dashboards =====================================
 851 | # These settings control loading the sample dashboards to the Kibana index. Loading
 852 | # the dashboards are disabled by default and can be enabled either by setting the
 853 | # options here, or by using the `-setup` CLI flag or the `setup` command.
 854 | #setup.dashboards.enabled: false
 855 | 
 856 | # The directory from where to read the dashboards. The default is the `kibana`
 857 | # folder in the home path.
 858 | #setup.dashboards.directory: ${path.home}/kibana
 859 | 
 860 | # The URL from where to download the dashboards archive. It is used instead of
 861 | # the directory if it has a value.
 862 | #setup.dashboards.url:
 863 | 
 864 | # The file archive (zip file) from where to read the dashboards. It is used instead
 865 | # of the directory when it has a value.
 866 | #setup.dashboards.file:
 867 | 
 868 | # In case the archive contains the dashboards from multiple Beats, this lets you
 869 | # select which one to load. You can load all the dashboards in the archive by
 870 | # setting this to the empty string.
 871 | #setup.dashboards.beat: nagioscheckbeat
 872 | 
 873 | # The name of the Kibana index to use for setting the configuration. Default is ".kibana"
 874 | #setup.dashboards.kibana_index: .kibana
 875 | 
 876 | # The Elasticsearch index name. This overwrites the index name defined in the
 877 | # dashboards and index pattern. Example: testbeat-*
 878 | #setup.dashboards.index:
 879 | 
 880 | # Always use the Kibana API for loading the dashboards instead of autodetecting
 881 | # how to install the dashboards by first querying Elasticsearch.
 882 | #setup.dashboards.always_kibana: false
 883 | 
 884 | # If true and Kibana is not reachable at the time when dashboards are loaded,
 885 | # it will retry to reconnect to Kibana instead of exiting with an error.
 886 | #setup.dashboards.retry.enabled: false
 887 | 
 888 | # Duration interval between Kibana connection retries.
 889 | #setup.dashboards.retry.interval: 1s
 890 | 
 891 | # Maximum number of retries before exiting with an error, 0 for unlimited retrying.
 892 | #setup.dashboards.retry.maximum: 0
 893 | 
 894 | 
 895 | #============================== Template =====================================
 896 | 
 897 | # A template is used to set the mapping in Elasticsearch
 898 | # By default template loading is enabled and the template is loaded.
 899 | # These settings can be adjusted to load your own template or overwrite existing ones.
 900 | 
 901 | # Set to false to disable template loading.
 902 | #setup.template.enabled: true
 903 | 
 904 | # Template name. By default the template name is "nagioscheckbeat-%{[agent.version]}"
 905 | # The template name and pattern has to be set in case the Elasticsearch index pattern is modified.
 906 | #setup.template.name: "nagioscheckbeat-%{[agent.version]}"
 907 | 
 908 | # Template pattern. By default the template pattern is "-%{[agent.version]}-*" to apply to the default index settings.
 909 | # The first part is the version of the beat and then -* is used to match all daily indices.
 910 | # The template name and pattern has to be set in case the Elasticsearch index pattern is modified.
 911 | #setup.template.pattern: "nagioscheckbeat-%{[agent.version]}-*"
 912 | 
 913 | # Path to fields.yml file to generate the template
 914 | #setup.template.fields: "${path.config}/fields.yml"
 915 | 
 916 | # A list of fields to be added to the template and Kibana index pattern. Also
 917 | # specify setup.template.overwrite: true to overwrite the existing template.
 918 | # This setting is experimental.
 919 | #setup.template.append_fields:
 920 | #- name: field_name
 921 | #  type: field_type
 922 | 
 923 | # Enable JSON template loading. If this is enabled, the fields.yml is ignored.
 924 | #setup.template.json.enabled: false
 925 | 
 926 | # Path to the JSON template file
 927 | #setup.template.json.path: "${path.config}/template.json"
 928 | 
 929 | # Name under which the template is stored in Elasticsearch
 930 | #setup.template.json.name: ""
 931 | 
 932 | # Overwrite existing template
 933 | #setup.template.overwrite: false
 934 | 
 935 | # Elasticsearch template settings
 936 | setup.template.settings:
 937 | 
 938 |   # A dictionary of settings to place into the settings.index dictionary
 939 |   # of the Elasticsearch template. For more details, please check
 940 |   # https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
 941 |   #index:
 942 |     #number_of_shards: 1
 943 |     #codec: best_compression
 944 |     #number_of_routing_shards: 30
 945 | 
 946 |   # A dictionary of settings for the _source field. For more details, please check
 947 |   # https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html
 948 |   #_source:
 949 |     #enabled: false
 950 | 
 951 | #============================== Setup ILM =====================================
 952 | 
 953 | # Configure index lifecycle management (ILM). These settings create a write
 954 | # alias and add additional settings to the index template. When ILM is enabled,
 955 | # output.elasticsearch.index is ignored, and the write alias is used to set the
 956 | # index name.
 957 | 
 958 | # Enable ILM support. Valid values are true, false, and auto. When set to auto
 959 | # (the default), the Beat uses index lifecycle management when it connects to a
 960 | # cluster that supports ILM; otherwise, it creates daily indices.
 961 | #setup.ilm.enabled: auto
 962 | 
 963 | # Set the prefix used in the index lifecycle write alias name. The default alias
 964 | # name is 'nagioscheckbeat-%{[agent.version]}'.
 965 | #setup.ilm.rollover_alias: "nagioscheckbeat"
 966 | 
 967 | # Set the rollover index pattern. The default is "%{now/d}-000001".
 968 | #setup.ilm.pattern: "{now/d}-000001"
 969 | 
 970 | # Set the lifecycle policy name. The default policy name is
 971 | # 'nagioscheckbeat-%{[agent.version]}'.
 972 | #setup.ilm.policy_name: "mypolicy"
 973 | 
 974 | # The path to a JSON file that contains a lifecycle policy configuration. Used
 975 | # to load your own lifecycle policy.
 976 | #setup.ilm.policy_file:
 977 | 
 978 | # Disable the check for an existing lifecycle policy. The default is false. If
 979 | # you disable this check, set setup.ilm.overwrite: true so the lifecycle policy
 980 | # can be installed.
 981 | #setup.ilm.check_exists: false
 982 | 
 983 | # Overwrite the lifecycle policy at startup. The default is false.
 984 | #setup.ilm.overwrite: false
 985 | 
 986 | #============================== Kibana =====================================
 987 | 
 988 | # Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
 989 | # This requires a Kibana endpoint configuration.
 990 | setup.kibana:
 991 | 
 992 |   # Kibana Host
 993 |   # Scheme and port can be left out and will be set to the default (http and 5601)
 994 |   # In case you specify and additional path, the scheme is required: http://localhost:5601/path
 995 |   # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
 996 |   #host: "localhost:5601"
 997 | 
 998 |   # Optional protocol and basic auth credentials.
 999 |   #protocol: "https"
1000 |   #username: "elastic"
1001 |   #password: "changeme"
1002 | 
1003 |   # Optional HTTP path
1004 |   #path: ""
1005 | 
1006 |   # Use SSL settings for HTTPS. Default is true.
1007 |   #ssl.enabled: true
1008 | 
1009 |   # Configure SSL verification mode. If `none` is configured, all server hosts
1010 |   # and certificates will be accepted. In this mode, SSL based connections are
1011 |   # susceptible to man-in-the-middle attacks. Use only for testing. Default is
1012 |   # `full`.
1013 |   #ssl.verification_mode: full
1014 | 
1015 |   # List of supported/valid TLS versions. By default all TLS versions from 1.0 up to
1016 |   # 1.2 are enabled.
1017 |   #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]
1018 | 
1019 |   # SSL configuration. The default is off.
1020 |   # List of root certificates for HTTPS server verifications
1021 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
1022 | 
1023 |   # Certificate for SSL client authentication
1024 |   #ssl.certificate: "/etc/pki/client/cert.pem"
1025 | 
1026 |   # Client certificate key
1027 |   #ssl.key: "/etc/pki/client/cert.key"
1028 | 
1029 |   # Optional passphrase for decrypting the certificate key.
1030 |   #ssl.key_passphrase: ''
1031 | 
1032 |   # Configure cipher suites to be used for SSL connections
1033 |   #ssl.cipher_suites: []
1034 | 
1035 |   # Configure curve types for ECDHE-based cipher suites
1036 |   #ssl.curve_types: []
1037 | 
1038 | 
1039 | 
1040 | #================================ Logging ======================================
1041 | # There are four options for the log output: file, stderr, syslog, eventlog
1042 | # The file output is the default.
1043 | 
1044 | # Sets log level. The default log level is info.
1045 | # Available log levels are: error, warning, info, debug
1046 | #logging.level: info
1047 | 
1048 | # Enable debug output for selected components. To enable all selectors use ["*"]
1049 | # Other available selectors are "beat", "publish", "service"
1050 | # Multiple selectors can be chained.
1051 | #logging.selectors: [ ]
1052 | 
1053 | # Send all logging output to stderr. The default is false.
1054 | #logging.to_stderr: false
1055 | 
1056 | # Send all logging output to syslog. The default is false.
1057 | #logging.to_syslog: false
1058 | 
1059 | # Send all logging output to Windows Event Logs. The default is false.
1060 | #logging.to_eventlog: false
1061 | 
1062 | # If enabled, Nagioscheckbeat periodically logs its internal metrics that have changed
1063 | # in the last period. For each metric that changed, the delta from the value at
1064 | # the beginning of the period is logged. Also, the total values for
1065 | # all non-zero internal metrics are logged on shutdown. The default is true.
1066 | #logging.metrics.enabled: true
1067 | 
1068 | # The period after which to log the internal metrics. The default is 30s.
1069 | #logging.metrics.period: 30s
1070 | 
1071 | # Logging to rotating files. Set logging.to_files to false to disable logging to
1072 | # files.
1073 | logging.to_files: true
1074 | logging.files:
1075 |   # Configure the path where the logs are written. The default is the logs directory
1076 |   # under the home path (the binary location).
1077 |   #path: /var/log/nagioscheckbeat
1078 | 
1079 |   # The name of the files where the logs are written to.
1080 |   #name: nagioscheckbeat
1081 | 
1082 |   # Configure log file size limit. If limit is reached, log file will be
1083 |   # automatically rotated
1084 |   #rotateeverybytes: 10485760 # = 10MB
1085 | 
1086 |   # Number of rotated log files to keep. Oldest files will be deleted first.
1087 |   #keepfiles: 7
1088 | 
1089 |   # The permissions mask to apply when rotating log files. The default value is 0600.
1090 |   # Must be a valid Unix-style file permissions mask expressed in octal notation.
1091 |   #permissions: 0600
1092 | 
1093 |   # Enable log file rotation on time intervals in addition to size-based rotation.
1094 |   # Intervals must be at least 1s. Values of 1m, 1h, 24h, 7*24h, 30*24h, and 365*24h
1095 |   # are boundary-aligned with minutes, hours, days, weeks, months, and years as
1096 |   # reported by the local system clock. All other intervals are calculated from the
1097 |   # Unix epoch. Defaults to disabled.
1098 |   #interval: 0
1099 | 
1100 |   # Rotate existing logs on startup rather than appending to the existing
1101 |   # file. Defaults to true.
1102 |   # rotateonstartup: true
1103 | 
1104 | # Set to true to log messages in JSON format.
1105 | #logging.json: false
1106 | 
1107 | 
1108 | #============================== X-Pack Monitoring ===============================
1109 | # Nagioscheckbeat can export internal metrics to a central Elasticsearch monitoring
1110 | # cluster.  This requires xpack monitoring to be enabled in Elasticsearch.  The
1111 | # reporting is disabled by default.
1112 | 
1113 | # Set to true to enable the monitoring reporter.
1114 | #monitoring.enabled: false
1115 | 
1116 | # Sets the UUID of the Elasticsearch cluster under which monitoring data for this
1117 | # Nagioscheckbeat instance will appear in the Stack Monitoring UI. If output.elasticsearch
1118 | # is enabled, the UUID is derived from the Elasticsearch cluster referenced by output.elasticsearch.
1119 | #monitoring.cluster_uuid:
1120 | 
1121 | # Uncomment to send the metrics to Elasticsearch. Most settings from the
1122 | # Elasticsearch output are accepted here as well.
1123 | # Note that the settings should point to your Elasticsearch *monitoring* cluster.
1124 | # Any setting that is not set is automatically inherited from the Elasticsearch
1125 | # output configuration, so if you have the Elasticsearch output configured such
1126 | # that it is pointing to your Elasticsearch monitoring cluster, you can simply
1127 | # uncomment the following line.
1128 | #monitoring.elasticsearch:
1129 | 
1130 |   # Array of hosts to connect to.
1131 |   # Scheme and port can be left out and will be set to the default (http and 9200)
1132 |   # In case you specify and additional path, the scheme is required: http://localhost:9200/path
1133 |   # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
1134 |   #hosts: ["localhost:9200"]
1135 | 
1136 |   # Set gzip compression level.
1137 |   #compression_level: 0
1138 | 
1139 |   # Protocol - either `http` (default) or `https`.
1140 |   #protocol: "https"
1141 | 
1142 |   # Authentication credentials - either API key or username/password.
1143 |   #api_key: "id:api_key"
1144 |   #username: "beats_system"
1145 |   #password: "changeme"
1146 | 
1147 |   # Dictionary of HTTP parameters to pass within the URL with index operations.
1148 |   #parameters:
1149 |     #param1: value1
1150 |     #param2: value2
1151 | 
1152 |   # Custom HTTP headers to add to each request
1153 |   #headers:
1154 |   #  X-My-Header: Contents of the header
1155 | 
1156 |   # Proxy server url
1157 |   #proxy_url: http://proxy:3128
1158 | 
1159 |   # The number of times a particular Elasticsearch index operation is attempted. If
1160 |   # the indexing operation doesn't succeed after this many retries, the events are
1161 |   # dropped. The default is 3.
1162 |   #max_retries: 3
1163 | 
1164 |   # The maximum number of events to bulk in a single Elasticsearch bulk API index request.
1165 |   # The default is 50.
1166 |   #bulk_max_size: 50
1167 | 
1168 |   # The number of seconds to wait before trying to reconnect to Elasticsearch
1169 |   # after a network error. After waiting backoff.init seconds, the Beat
1170 |   # tries to reconnect. If the attempt fails, the backoff timer is increased
1171 |   # exponentially up to backoff.max. After a successful connection, the backoff
1172 |   # timer is reset. The default is 1s.
1173 |   #backoff.init: 1s
1174 | 
1175 |   # The maximum number of seconds to wait before attempting to connect to
1176 |   # Elasticsearch after a network error. The default is 60s.
1177 |   #backoff.max: 60s
1178 | 
1179 |   # Configure HTTP request timeout before failing an request to Elasticsearch.
1180 |   #timeout: 90
1181 | 
1182 |   # Use SSL settings for HTTPS.
1183 |   #ssl.enabled: true
1184 | 
1185 |   # Configure SSL verification mode. If `none` is configured, all server hosts
1186 |   # and certificates will be accepted. In this mode, SSL based connections are
1187 |   # susceptible to man-in-the-middle attacks. Use only for testing. Default is
1188 |   # `full`.
1189 |   #ssl.verification_mode: full
1190 | 
1191 |   # List of supported/valid TLS versions. By default all TLS versions from 1.0 up to
1192 |   # 1.2 are enabled.
1193 |   #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]
1194 | 
1195 |   # SSL configuration. The default is off.
1196 |   # List of root certificates for HTTPS server verifications
1197 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
1198 | 
1199 |   # Certificate for SSL client authentication
1200 |   #ssl.certificate: "/etc/pki/client/cert.pem"
1201 | 
1202 |   # Client certificate key
1203 |   #ssl.key: "/etc/pki/client/cert.key"
1204 | 
1205 |   # Optional passphrase for decrypting the certificate key.
1206 |   #ssl.key_passphrase: ''
1207 | 
1208 |   # Configure cipher suites to be used for SSL connections
1209 |   #ssl.cipher_suites: []
1210 | 
1211 |   # Configure curve types for ECDHE-based cipher suites
1212 |   #ssl.curve_types: []
1213 | 
1214 |   # Configure what types of renegotiation are supported. Valid options are
1215 |   # never, once, and freely. Default is never.
1216 |   #ssl.renegotiation: never
1217 | 
1218 |   #metrics.period: 10s
1219 |   #state.period: 1m
1220 | 
1221 | #================================ HTTP Endpoint ======================================
1222 | # Each beat can expose internal metrics through a HTTP endpoint. For security
1223 | # reasons the endpoint is disabled by default. This feature is currently experimental.
1224 | # Stats can be access through http://localhost:5066/stats . For pretty JSON output
1225 | # append ?pretty to the URL.
1226 | 
1227 | # Defines if the HTTP endpoint is enabled.
1228 | #http.enabled: false
1229 | 
1230 | # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
1231 | # When using IP addresses, it is recommended to only use localhost.
1232 | #http.host: localhost
1233 | 
1234 | # Port on which the HTTP endpoint will bind. Default is 5066.
1235 | #http.port: 5066
1236 | 
1237 | # Define which user should be owning the named pipe.
1238 | #http.named_pipe.user:
1239 | 
1240 | # Define which the permissions that should be applied to the named pipe, use the Security
1241 | # Descriptor Definition Language (SDDL) to define the permission. This option cannot be used with
1242 | # `http.user`.
1243 | #http.named_pipe.security_descriptor:
1244 | 
1245 | #============================= Process Security ================================
1246 | 
1247 | # Enable or disable seccomp system call filtering on Linux. Default is enabled.
1248 | #seccomp.enabled: true
1249 | 
1250 | #================================= Migration ==================================
1251 | 
1252 | # This allows to enable 6.7 migration aliases
1253 | #migration.6_to_7.enabled: false
1254 | 


--------------------------------------------------------------------------------
/nagioscheckbeat.yml:
--------------------------------------------------------------------------------
  1 | ################### Nagioscheckbeat Configuration Example #########################
  2 | 
  3 | ############################# Nagioscheckbeat ######################################
  4 | 
  5 | nagioscheckbeat:
  6 |    checks:
  7 |     -
  8 |       name: "heartbeat"
  9 |       cmd: "/usr/lib64/nagios/plugins/check_dummy"
 10 |       args: "0 Checking In!"
 11 |       period: "10s"
 12 | 
 13 | #================================ General =====================================
 14 | 
 15 | # The name of the shipper that publishes the network data. It can be used to group
 16 | # all the transactions sent by a single shipper in the web interface.
 17 | #name:
 18 | 
 19 | # The tags of the shipper are included in their own field with each
 20 | # transaction published.
 21 | #tags: ["service-X", "web-tier"]
 22 | 
 23 | # Optional fields that you can specify to add additional information to the
 24 | # output.
 25 | #fields:
 26 | #  env: staging
 27 | 
 28 | 
 29 | #============================== Dashboards =====================================
 30 | # These settings control loading the sample dashboards to the Kibana index. Loading
 31 | # the dashboards is disabled by default and can be enabled either by setting the
 32 | # options here or by using the `setup` command.
 33 | #setup.dashboards.enabled: false
 34 | 
 35 | # The URL from where to download the dashboards archive. By default this URL
 36 | # has a value which is computed based on the Beat name and version. For released
 37 | # versions, this URL points to the dashboard archive on the artifacts.elastic.co
 38 | # website.
 39 | #setup.dashboards.url:
 40 | 
 41 | #============================== Kibana =====================================
 42 | 
 43 | # Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
 44 | # This requires a Kibana endpoint configuration.
 45 | setup.kibana:
 46 | 
 47 |   # Kibana Host
 48 |   # Scheme and port can be left out and will be set to the default (http and 5601)
 49 |   # In case you specify and additional path, the scheme is required: http://localhost:5601/path
 50 |   # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
 51 |   #host: "localhost:5601"
 52 | 
 53 |   # Kibana Space ID
 54 |   # ID of the Kibana Space into which the dashboards should be loaded. By default,
 55 |   # the Default Space will be used.
 56 |   #space.id:
 57 | 
 58 | #============================= Elastic Cloud ==================================
 59 | 
 60 | # These settings simplify using Nagioscheckbeat with the Elastic Cloud (https://cloud.elastic.co/).
 61 | 
 62 | # The cloud.id setting overwrites the `output.elasticsearch.hosts` and
 63 | # `setup.kibana.host` options.
 64 | # You can find the `cloud.id` in the Elastic Cloud web UI.
 65 | #cloud.id:
 66 | 
 67 | # The cloud.auth setting overwrites the `output.elasticsearch.username` and
 68 | # `output.elasticsearch.password` settings. The format is `:`.
 69 | #cloud.auth:
 70 | 
 71 | #================================ Outputs =====================================
 72 | 
 73 | # Configure what output to use when sending the data collected by the beat.
 74 | 
 75 | #-------------------------- Elasticsearch output ------------------------------
 76 | output.elasticsearch:
 77 |   # Array of hosts to connect to.
 78 |   hosts: ["localhost:9200"]
 79 | 
 80 |   # Protocol - either `http` (default) or `https`.
 81 |   #protocol: "https"
 82 | 
 83 |   # Authentication credentials - either API key or username/password.
 84 |   #api_key: "id:api_key"
 85 |   #username: "elastic"
 86 |   #password: "changeme"
 87 | 
 88 | #----------------------------- Logstash output --------------------------------
 89 | #output.logstash:
 90 |   # The Logstash hosts
 91 |   #hosts: ["localhost:5044"]
 92 | 
 93 |   # Optional SSL. By default is off.
 94 |   # List of root certificates for HTTPS server verifications
 95 |   #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
 96 | 
 97 |   # Certificate for SSL client authentication
 98 |   #ssl.certificate: "/etc/pki/client/cert.pem"
 99 | 
100 |   # Client Certificate Key
101 |   #ssl.key: "/etc/pki/client/cert.key"
102 | 
103 | #================================ Processors =====================================
104 | 
105 | # Configure processors to enhance or manipulate events generated by the beat.
106 | 
107 | processors:
108 |   - add_host_metadata: ~
109 |   - add_cloud_metadata: ~
110 |   - add_docker_metadata: ~
111 | 
112 | #================================ Logging =====================================
113 | 
114 | # Sets log level. The default log level is info.
115 | # Available log levels are: error, warning, info, debug
116 | #logging.level: debug
117 | 
118 | # At debug level, you can selectively enable logging only for some components.
119 | # To enable all selectors use ["*"]. Examples of other selectors are "beat",
120 | # "publish", "service".
121 | #logging.selectors: ["*"]
122 | 
123 | #============================== X-Pack Monitoring ===============================
124 | # nagioscheckbeat can export internal metrics to a central Elasticsearch monitoring
125 | # cluster.  This requires xpack monitoring to be enabled in Elasticsearch.  The
126 | # reporting is disabled by default.
127 | 
128 | # Set to true to enable the monitoring reporter.
129 | #monitoring.enabled: false
130 | 
131 | # Sets the UUID of the Elasticsearch cluster under which monitoring data for this
132 | # Nagioscheckbeat instance will appear in the Stack Monitoring UI. If output.elasticsearch
133 | # is enabled, the UUID is derived from the Elasticsearch cluster referenced by output.elasticsearch.
134 | #monitoring.cluster_uuid:
135 | 
136 | # Uncomment to send the metrics to Elasticsearch. Most settings from the
137 | # Elasticsearch output are accepted here as well.
138 | # Note that the settings should point to your Elasticsearch *monitoring* cluster.
139 | # Any setting that is not set is automatically inherited from the Elasticsearch
140 | # output configuration, so if you have the Elasticsearch output configured such
141 | # that it is pointing to your Elasticsearch monitoring cluster, you can simply
142 | # uncomment the following line.
143 | #monitoring.elasticsearch:
144 | 
145 | #================================= Migration ==================================
146 | 
147 | # This allows to enable 6.7 migration aliases
148 | #migration.6_to_7.enabled: true
149 | 


--------------------------------------------------------------------------------
/nagiosperf/nagiosperf.go:
--------------------------------------------------------------------------------
  1 | package nagiosperf
  2 | 
  3 | /*
  4 | Partial Go Implementation of:
  5 | http://cpansearch.perl.org/src/NIERLEIN/Monitoring-Plugin-0.39/lib/Monitoring/Plugin/Performance.pm
  6 | */
  7 | 
  8 | import (
  9 | 	"errors"
 10 | 	"github.com/mgutz/str"
 11 | 	"regexp"
 12 | 	"strconv"
 13 | 	"strings"
 14 | )
 15 | 
 16 | type Perf struct {
 17 | 	Label string
 18 | 	Uom   string
 19 | 
 20 | 	Value float64
 21 | 
 22 | 	Warning  float64
 23 | 	Critical float64
 24 | 	Min      float64
 25 | 	Max      float64
 26 | }
 27 | 
 28 | func NiceStatus(status int) string {
 29 | 	switch status {
 30 | 	case 0:
 31 | 		return "OK"
 32 | 	case 1:
 33 | 		return "WARNING"
 34 | 	case 2:
 35 | 		return "CRITICAL"
 36 | 	case 3:
 37 | 		return "UNKNOWN"
 38 | 	}
 39 | 	return "INVALID STATUS"
 40 | }
 41 | 
 42 | func parse(perfString string) (Perf, error) {
 43 | 
 44 | 	const (
 45 | 		Value                        = `[-+]?[\d\.,]+`
 46 | 		Value_re                     = Value + `(?:e` + Value + `)?`
 47 | 		Value_with_negative_infinity = Value_re + `|~`
 48 | 	)
 49 | 
 50 | 	var perf Perf
 51 | 
 52 | 	re := regexp.MustCompile(`^'?([^'=]+)'?=(` + Value_re + `)([\w%]*);?(` + Value_with_negative_infinity + `\:?` + Value_re + `?)?;?(` + Value_with_negative_infinity + `\:?` + Value_re + `?)?;?(` + Value_re + `)?;?(` + Value_re + `)?`)
 53 | 
 54 | 	results := re.FindStringSubmatch(perfString)
 55 | 	if results == nil || len(results) < 3 {
 56 | 		return perf, errors.New("Cannot Parse: " + perfString)
 57 | 	}
 58 | 
 59 | 	perf = Perf{}
 60 | 
 61 | 	perf.Label = results[1]
 62 | 	perf.Uom = results[3]
 63 | 
 64 | 	if v, err := strconv.ParseFloat(results[2], 64); err == nil {
 65 | 		perf.Value = v
 66 | 	} else if results[2] != "" {
 67 | 		return perf, err
 68 | 	}
 69 | 
 70 | 	if v, err := strconv.ParseFloat(results[4], 64); err == nil {
 71 | 		perf.Warning = v
 72 | 	} else if results[4] != "" {
 73 | 		return perf, err
 74 | 	}
 75 | 
 76 | 	if v, err := strconv.ParseFloat(results[5], 64); err == nil {
 77 | 		perf.Critical = v
 78 | 	} else if results[5] != "" {
 79 | 		return perf, err
 80 | 	}
 81 | 
 82 | 	if v, err := strconv.ParseFloat(results[6], 64); err == nil {
 83 | 		perf.Min = v
 84 | 	} else if results[6] != "" {
 85 | 		return perf, err
 86 | 	}
 87 | 
 88 | 	if v, err := strconv.ParseFloat(results[7], 64); err == nil {
 89 | 		perf.Max = v
 90 | 	} else if results[7] != "" {
 91 | 		return perf, err
 92 | 	}
 93 | 
 94 | 	return perf, nil
 95 | 
 96 | }
 97 | 
 98 | func ParsePerfString(perfString string) ([]Perf, []error) {
 99 | 
100 | 	var errors []error
101 | 
102 | 	perfs := []Perf{}
103 | 
104 | 	for _, element := range eachPerf(strings.TrimSpace(perfString)) {
105 | 
106 | 		perf, err := parse(element)
107 | 
108 | 		if err != nil {
109 | 			errors = append(errors, err)
110 | 		} else {
111 | 			perfs = append(perfs, perf)
112 | 		}
113 | 
114 | 	}
115 | 	return perfs, errors
116 | 
117 | }
118 | 
119 | /*
120 | Splits string by spaces, ignoring spaces between quotes
121 | */
122 | func eachPerf(perfString string) []string {
123 | 	return str.ToArgv(perfString)
124 | }
125 | 


--------------------------------------------------------------------------------
/nagiosperf/nagiosperf_test.go:
--------------------------------------------------------------------------------
 1 | package nagiosperf
 2 | 
 3 | import "testing"
 4 | import "reflect"
 5 | 
 6 | func TestParse(t *testing.T) {
 7 | 
 8 | 	cases := []struct {
 9 | 		in   string
10 | 		want []Perf
11 | 	}{
12 | 		{"load1=0.010;5.000;9.000;0; load5=0.060;5.000;9.000;0; load15=2.010;5.000;9.000;0; \n", []Perf{
13 | 			{Label: "load1", Value: 0.01, Warning: 5, Critical: 9, Min: 0},
14 | 			{Label: "load5", Value: 0.06, Warning: 5, Critical: 9, Min: 0},
15 | 			{Label: "load15", Value: 2.01, Warning: 5, Critical: 9, Min: 0},
16 | 		}},
17 | 		{"users=4;20;50;0", []Perf{
18 | 			{Label: "users", Value: 4, Warning: 20, Critical: 50, Min: 0},
19 | 		}},
20 | 		{"/home/a-m=0;0;0 shared-folder:big=20 12345678901234567890=20", []Perf{
21 | 			{Label: "/home/a-m", Value: 0, Warning: 0, Critical: 0},
22 | 			{Label: "shared-folder:big", Value: 20},
23 | 			{Label: "12345678901234567890", Value: 20},
24 | 		}},
25 | 		{"time=0.002722s;0.000000;0.000000;0.000000;10.000000", []Perf{
26 | 			{Label: "time", Value: 0.002722, Uom: "s", Max: 10},
27 | 		}},
28 | 		{"'Waiting for Connection'=22 'Starting Up'=1 'kB per sec'=0.0KB\n", []Perf{
29 | 			{Label: "Waiting for Connection", Value: 22},
30 | 			{Label: "Starting Up", Value: 1},
31 | 			{Label: "kB per sec", Value: 0.0, Uom: "KB"},
32 | 		}},
33 | 		{"", []Perf{}},
34 | 	}
35 | 	for _, c := range cases {
36 | 		got, errors := ParsePerfString(c.in)
37 | 		if len(errors) > 0 {
38 | 			for _, err := range errors {
39 | 				t.Errorf("ParsePerfString(%q) returned error: '%s'", c.in, err)
40 | 			}
41 | 			continue
42 | 		}
43 | 
44 | 		if !reflect.DeepEqual(c.want, got) {
45 | 			t.Errorf("ParsePerfString(%q):\n WANT: %v\n GOT: %v", c.in, c.want, got)
46 | 			continue
47 | 		}
48 | 	}
49 | }
50 | 


--------------------------------------------------------------------------------
/ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PhaedrusTheGreek/nagioscheckbeat/d67fb558ab997869e2c6e8c30fee8e84de5336fd/ss.png


--------------------------------------------------------------------------------
/tests/system/config/nagioscheckbeat.yml.j2:
--------------------------------------------------------------------------------
 1 | ################### Beat Configuration #########################
 2 | 
 3 | 
 4 | 
 5 | ############################# Output ##########################################
 6 | 
 7 | # Configure what outputs to use when sending the data collected by the beat.
 8 | # You can enable one or multiple outputs by setting enabled option to true.
 9 | output:
10 | 
11 |   ### File as output
12 |   file:
13 |     # Enabling file output
14 |     enabled: true
15 | 
16 |     # Path to the directory where to save the generated files. The option is mandatory.
17 |     path: {{ output_file_path|default(beat.working_dir + "/output") }}
18 | 
19 | 
20 |     # Name of the generated files. The default is `nagioscheckbeat` and it generates
21 |     # files: `nagioscheckbeat`, `nagioscheckbeat.1`, `nagioscheckbeat.2`, etc.
22 |     filename: {{ output_file_filename|default("nagioscheckbeat") }}
23 | 
24 |     # Maximum size in kilobytes of each file. When this size is reached, the files are
25 |     # rotated. The default value is 10 MB.
26 |     #rotate_every_kb: 10000
27 | 
28 |     # Maximum number of files under path. When this number of files is reached, the
29 |     # oldest file is deleted and the rest are shifted from last to first. The default
30 |     # is 7 files.
31 |     #number_of_files: 7
32 | 
33 | 
34 | 
35 | ############################# Beat #########################################
36 | 
37 | # The name of the shipper that publishes the network data. It can be used to group
38 | # all the transactions sent by a single shipper in the web interface.
39 | # If this options is not defined, the hostname is used.
40 | #name:
41 | 
42 | # The tags of the shipper are included in their own field with each
43 | # transaction published. Tags make it easy to group servers by different
44 | # logical properties.
45 | #tags: ["service-X", "web-tier"]
46 | 
47 | 
48 | 
49 | ############################# Logging #########################################
50 | 
51 | #logging:
52 |   # Send all logging output to syslog. On Windows default is false, otherwise
53 |   # default is true.
54 |   #to_syslog: true
55 | 
56 |   # Write all logging output to files. Beats automatically rotate files if configurable
57 |   # limit is reached.
58 |   #to_files: false
59 | 
60 |   # Enable debug output for selected components.
61 |   #selectors: []
62 | 
63 |   # Set log level
64 |   #level: error
65 | 
66 |   #files:
67 |     # The directory where the log files will written to.
68 |     #path: /var/log/nagioscheckbeat
69 | 
70 |     # The name of the files where the logs are written to.
71 |     #name: nagioscheckbeat
72 | 
73 |     # Configure log file size limit. If limit is reached, log file will be
74 |     # automatically rotated
75 |     #rotateeverybytes: 10485760 # = 10MB
76 | 
77 |     # Number of rotated log files to keep. Oldest files will be deleted first.
78 |     #keepfiles: 7
79 | 


--------------------------------------------------------------------------------
/tests/system/nagioscheckbeat.py:
--------------------------------------------------------------------------------
 1 | import os
 2 | import sys
 3 | sys.path.append('../../vendor/github.com/elastic/beats/libbeat/tests/system')
 4 | from beat.beat import TestCase
 5 | 
 6 | 
 7 | class BaseTest(TestCase):
 8 | 
 9 |     @classmethod
10 |     def setUpClass(self):
11 |         self.beat_name = "nagioscheckbeat"
12 |         self.beat_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))
13 |         super(BaseTest, self).setUpClass()
14 | 


--------------------------------------------------------------------------------
/tests/system/requirements.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PhaedrusTheGreek/nagioscheckbeat/d67fb558ab997869e2c6e8c30fee8e84de5336fd/tests/system/requirements.txt


--------------------------------------------------------------------------------
/tests/system/test_base.py:
--------------------------------------------------------------------------------
 1 | from nagioscheckbeat import BaseTest
 2 | 
 3 | import os
 4 | 
 5 | 
 6 | class Test(BaseTest):
 7 | 
 8 |     def test_base(self):
 9 |         """
10 |         Basic test with exiting Nagioscheckbeat normally
11 |         """
12 |         self.render_config_template(
13 |             path=os.path.abspath(self.working_dir) + "/log/*"
14 |         )
15 | 
16 |         nagioscheckbeat_proc = self.start_beat()
17 |         self.wait_until(lambda: self.log_contains("nagioscheckbeat is running"))
18 |         exit_code = nagioscheckbeat_proc.kill_and_wait()
19 |         assert exit_code == 0
20 | 


--------------------------------------------------------------------------------