icinga2 writing
icinga2 is an open-source, host and network monitoring software initially developed from the Nagios network monitoring application. Currently, icinga2 is distributed under the GNU GPL v2 license.
You can write the data collected by icinga2 to TDengine by simply modifying the icinga2 configuration to point to the taosAdapter server and the corresponding port, taking advantage of TDengine's efficient storage and query performance and clustering capabilities for time-series data.
Prerequisites
To write icinga2 data to TDengine requires the following preparations.
- The TDengine cluster is deployed and working properly
- taosAdapter is installed and running properly. Please refer to the taosAdapter manual for details.
- icinga2 has been installed. Please refer to the official documentation for icinga2 installation
Configuration steps
Configuring taosAdapter
To configure taosAdapter to receive icinga2 data.
- Enable the configuration item in the taosAdapter configuration file (default location /etc/taos/taosadapter.toml)
...
[opentsdb_telnet]
enable = true
maxTCPConnections = 250
tcpKeepAlive = false
dbs = ["opentsdb_telnet", "collectd", "icinga2", "tcollector"]
ports = [6046, 6047, 6048, 6049]
user = "root"
password = "taosdata"
...
The default database name written by the taosAdapter is icinga2
. You can also modify the taosAdapter configuration file dbs entry to specify a different name. user and password are the values configured by the actual TDengine. You need to restart the taosAdapter after modification.
- You can also enable taosAdapter to receive icinga2 data by using the taosAdapter command-line parameters or setting environment variables.
Configure icinga3
- Enable opentsdb-writer for icinga2 (refer to the link https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer)
- Modify the configuration file
/etc/icinga2/features-enabled/opentsdb.conf
by filling in <taosAdapter's host> as the domain name or IP address of the server running taosAdapter and <port for icinga2> as the corresponding port on which taosAdapter supports receiving icinga2 data (default is 6048)
object OpenTsdbWriter "opentsdb" {
host = "<taosAdapter's host>"
port = <port for icinga2>
}
Example file:
object OpenTsdbWriter "opentsdb" {
host = "127.0.0.1"
port = 6048
}
Verification method
Restart taosAdapter:
sudo systemctl restart taosadapter
Restart icinga2:
sudo systemctl restart icinga2
After waiting about 10 seconds, use the TDengine CLI to query TDengine to verify that the appropriate database has been created and data are written.
taos> show databases;
name |
=================================
information_schema |
performance_schema |
icinga2 |
Query OK, 3 row(s) in set (0.001867s)
taos> use icinga2;
Database changed.
taos> show stables;
name |
=================================
icinga.service.users.state_... |
icinga.service.users.acknow... |
icinga.service.procs.downti... |
icinga.service.users.users |
icinga.service.procs.procs_min |
icinga.service.users.users_min |
icinga.check.max_check_atte... |
icinga.service.procs.state_... |
icinga.service.procs.procs_... |
icinga.service.users.users_... |
icinga.check.latency |
icinga.service.procs.procs_... |
icinga.service.users.downti... |
icinga.service.users.users_... |
icinga.service.users.reachable |
icinga.service.procs.procs |
icinga.service.procs.acknow... |
icinga.service.procs.state |
icinga.service.procs.reachable |
icinga.check.current_attempt |
icinga.check.execution_time |
icinga.service.users.state |
Query OK, 22 row(s) in set (0.002317s)
- TDengine will automatically create unique IDs for sub-table names by the rule.