You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bastien 266e18407a Password 1 year ago
collectors Password 1 year ago
.gitignore add a makefile 3 years ago
CMakeLists.txt Password 1 year ago
Makefile add a makefile 3 years ago
README.md add readme 3 years ago
build.sh change project name "collectd" -> "ucollector" 3 years ago
collector.c Move from opentsdb to influxdb 2 years ago
collector.h Move from opentsdb to influxdb 2 years ago
collector_queue.c refactoring 3 years ago
collector_queue.h refactoring 3 years ago
config.h Move from opentsdb to influxdb 2 years ago
config.h.in fix segmentation fault 3 years ago
config_parser.c Password 1 year ago
config_parser.h Move from opentsdb to influxdb 2 years ago
host.c allow override hostname 3 years ago
host.h factorize ip_stack_t 3 years ago
metrics add domain collector 3 years ago
network.c try to fix binary 3 years ago
network.h try to fix binary 3 years ago
prod.conf add readme 3 years ago
tls.c try to fix binary 3 years ago
tls.h try to fix binary 3 years ago
tsdb.c Password 1 year ago
tsdb.h Password 1 year ago
ucollector.c Move from opentsdb to influxdb 2 years ago
ucollector.conf add domain collector 3 years ago
utils.c add buffalo collector 3 years ago
utils.h add buffalo collector 3 years ago

README.md

μcollector

μcollector is a replacement for OpenTSDB’s tcollector and Bosun’s scollector.

It is designed for my own needs and so, some parts are incomplete or not well adapted for other use cases.

μcollector provides basic checks provided by monitoring-plugins, like check_ping, check_http, check_smtp and so on.

The results are sent in an http request. The authentication with the http server is done with TLS client certs. passwords are not currently supported.

Installation

Install dependencies

json-c ldns

Build

cd ucollector
mkdir build
cd build
cmake ../
make`

You can use the following option in order to print only data on stdout and not sent: cmake -DMOCK=1 ../

Configuration

Two types of checks are performed:

  • local checks get values from the local computer (cpu, memory used, …)
  • remote checks perform tests from a probing computer. It is useful to test network applications (ping rtt, smtp response time, …)

So, the configuration file is in json format (because I didn’t want to write a full parser with flex and bison). It is divided into two parts,

  • tsdb: to set server settings:
    • domain: the domain in which the tsdb server is (it looks for a _monitoring._tcp. record in the dns)
    • put_max_size: the size of a query
    • tls_ca_crt_filename: the CA certificate to check the certificate provided by the server
    • tls_client_crt_filename: the certificate used by the client
    • tls_client_key_filename: the certificate used by the client
  • collectors: to set the checks performed
    • hosts: to set remote checks
    • local: to set local checks

A complete file looks like this:

{
	"tsdb": {
		"domain": "confais.org",
		"url": "/api/put",
		"put_max_size": 8192,
		"tls_ca_crt_filename": "/usr/share/ca-certificates/trust-source/anchors/confais.org.rootCA.crt",
		"tls_client_crt_filename": "/tmp/monitoring.confais.org.ucollector.crt",
		"tls_client_key_filename": "/tmp/monitoring.confais.org.ucollector.key",
	},
	"collectors": {
		"hosts": {
			"squiz.confais.org": {
				"ipv4": "192.168.10.20",
				"ipv6": "2001:470:c8cb:1:beee:7bff:fe9e:73f8",
				"collectors": [
					{"function": "collector_ping", "frequency": 300, "type": "ipv4"},
					{"function": "collector_ping", "frequency": 300, "type": "ipv6"},
					{"function": "collector_ssh",  "frequency": 600, "type": "ipv4", "port": "2200"},
					{"function": "collector_ssh",  "frequency": 600, "type": "ipv6", "port": "2200"},
					{"function": "collector_smtp", "frequency": 600, "type": "ipv4", "port": "25", "tls": true, "tls_ca_crt_filename": "/usr/share/ca-certificates/trust-source/anchors/confais.org.rootCA.crt", "spam_test": true},
					{"function": "collector_smtp", "frequency": 600, "type": "ipv6", "port": "25", "tls": true, "tls_ca_crt_filename": "/usr/share/ca-certificates/trust-source/anchors/confais.org.rootCA.crt", "spam_test": true},
					{"function": "collector_dns",  "frequency": 3600
						, "authoritative": { "type": "ipv4", "port": 53, "A": false, "AAAA": true } 
						, "external": { "type": "ipv4", "nameserver": "80.67.169.40", "port": 53, "A": false, "AAAA": true, "reverse_A": false, "reverse_AAAA": true } 
						, "dnssec": false
						, "recursive": { "type": "ipv4", "port": 53, "query": "example.com", "query_type": "A", "has_to_succeed": false }
					},
					{"function": "collector_dns",  "frequency": 3600
						, "authoritative": { "type": "ipv6", "port": 53, "A": false, "AAAA": true } 
						, "external": { "type": "ipv6", "nameserver": "2001:910:800::40", "port": 53, "A": false, "AAAA": true, "reverse_A": false, "reverse_AAAA": true } 
						, "dnssec": { "type": "ipv6", "nameserver": "::1", "port": 53, "trace_from_root": "/etc/unbound/keys/root.key", "trace_from_confais_org": "/etc/unbound/keys/confais.org.key" }
						, "recursive": { "type": "ipv6", "port": 53, "query": "example.com", "query_type": "AAAA", "has_to_succeed": false }
					},
				]
			},
		},
		"local": [
			{"function": "collector_stats", "frequency": 60},
			{"function": "collector_mailq", "frequency": 60},
			{"function": "collector_pacman", "frequency": 1800},
			{"function": "collector_x509", "frequency": 3600, "metric": "ucollector", "filename": "/tmp/monitoring.confais.org.ucollector.crt"},
		]
	}
}

The program is launched with

ucollector CONFIG=/path/to/ucollector.json