Griesbacher / nagflux

A connector which copies performancedata from Nagios / Icinga(2) / Naemon to InfluxDB
GNU General Public License v2.0
65 stars 30 forks source link

No data sent to influxdb #55

Closed stwongst closed 1 year ago

stwongst commented 1 year ago

Hi, we're using Nagflux 0.4.1, InfluxDB 1.8, and Naemon following steps here https://support.nagios.com/kb/article/nagios-core-performance-graphs-using-influxdb-nagflux-grafana-histou-802.html#Nagflux_Config.

When starting Nagflux, the db can be created in influxDB. However, no data is sent to influxDB.

We found that Nagflux keeps starting (always sees Started Nagflux) and read on the same performance data file /var/spool/nagflux/1663209466.perfdata.host which is the first one in the spool directory:

--- cut here --- 2022-09-15 17:35:51 Info: Started Nagflux v0.4.1 2022-09-15 17:35:51 Debug: Using Config: /usr/local/nagflux/config.gcfg 2022-09-15 17:35:51 Info: serving prometheus metrics at :8080/metrics 2022-09-15 17:35:51 Info: Is InfluxDB(nagflux) running: true 2022-09-15 17:35:51 Debug: Influxdb(nagflux) is running 2022-09-15 17:35:51 Debug: Dumpfile: nagflux.dump-nagflux.influx not found, skipping... (Everything is fine) 2022-09-15 17:35:51 Debug: DumpfileCollector stopped 2022-09-15 17:35:53 Info: Setting Livestatus version to: Naemon 2022-09-15 17:35:53 Info: Nagios Spoolfile Folder: /var/lib/naemon 2022-09-15 17:35:53 Info: Nagflux Spoolfile Folder: /var/spool/nagflux 2022-09-15 17:35:58 Debug: Reading Directory: /var/lib/naemon 2022-09-15 17:35:58 Debug: Reading file: /var/lib/naemon/naemon.cmd 2022-09-15 17:35:58 Debug: Reading file: /var/spool/nagflux/1663209466.perfdata.host

2022-09-15 17:35:58 Info: Started Nagflux v0.4.1 2022-09-15 17:35:58 Debug: Using Config: /usr/local/nagflux/config.gcfg 2022-09-15 17:35:58 Info: serving prometheus metrics at :8080/metrics 2022-09-15 17:35:58 Info: Is InfluxDB(nagflux) running: true 2022-09-15 17:35:58 Debug: Influxdb(nagflux) is running 2022-09-15 17:35:58 Debug: Dumpfile: nagflux.dump-nagflux.influx not found, skipping... (Everything is fine) 2022-09-15 17:35:58 Debug: DumpfileCollector stopped 2022-09-15 17:36:00 Info: Setting Livestatus version to: Naemon 2022-09-15 17:36:00 Info: Nagios Spoolfile Folder: /var/lib/naemon 2022-09-15 17:36:00 Info: Nagflux Spoolfile Folder: /var/spool/nagflux 2022-09-15 17:36:05 Debug: Reading Directory: /var/lib/naemon 2022-09-15 17:36:05 Debug: Reading file: /var/lib/naemon/host-perfdata 2022-09-15 17:36:05 Debug: Reading file: /var/lib/naemon/naemon.cmd 2022-09-15 17:36:05 Debug: Reading file: /var/spool/nagflux/1663209466.perfdata.host

2022-09-15 17:36:05 Info: Started Nagflux v0.4.1 2022-09-15 17:36:05 Debug: Using Config: /usr/local/nagflux/config.gcfg 2022-09-15 17:36:05 Info: serving prometheus metrics at :8080/metrics 2022-09-15 17:36:05 Info: Is InfluxDB(nagflux) running: true 2022-09-15 17:36:05 Debug: Influxdb(nagflux) is running 2022-09-15 17:36:05 Debug: Dumpfile: nagflux.dump-nagflux.influx not found, skipping... (Everything is fine) 2022-09-15 17:36:05 Debug: DumpfileCollector stopped 2022-09-15 17:36:07 Info: Setting Livestatus version to: Naemon 2022-09-15 17:36:07 Info: Nagios Spoolfile Folder: /var/lib/naemon 2022-09-15 17:36:07 Info: Nagflux Spoolfile Folder: /var/spool/nagflux 2022-09-15 17:36:12 Debug: Reading Directory: /var/lib/naemon 2022-09-15 17:36:12 Debug: Reading file: /var/lib/naemon/naemon.cmd 2022-09-15 17:36:12 Debug: Reading file: /var/spool/nagflux/1663209466.perfdata.host --- cut here ---

Since it's a testing Naemon, there is only 1 host with few monitors. Most of the performance data file are empty:

--- cut here ---

ls -l /var/spool/nagflux

total 972 -rw-r--r--. 1 naemon naemon 0 Sep 15 10:37 1663209466.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:37 1663209481.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:38 1663209496.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:38 1663209511.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:38 1663209526.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:38 1663209541.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:39 1663209556.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:39 1663209571.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:39 1663209586.perfdata.host -rw-r--r--. 1 naemon naemon 567 Sep 15 10:39 1663209601.perfdata.host -rw-r--r--. 1 naemon naemon 418 Sep 15 10:40 1663209616.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:40 1663209631.perfdata.host -rw-r--r--. 1 naemon naemon 539 Sep 15 10:40 1663209646.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:40 1663209661.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:41 1663209676.perfdata.host -rw-r--r--. 1 naemon naemon 0 Sep 15 10:41 1663209691.perfdata.host [snipped] --- cut here ---

Out Nagflux file looks like this:

--- cut here --- [main] NagiosSpoolfileFolder = "/var/lib/naemon" NagiosSpoolfileWorker = 1 InfluxWorker = 2 MaxInfluxWorker = 5 DumpFile = "nagflux.dump" NagfluxSpoolfileFolder = "/var/spool/nagflux" FieldSeparator = "&" BufferSize = 10000 FileBufferSize = 65536

If the performancedata does not have a certain target set with NAGFLUX:TARGET.

# The following field will define the target for this data.
# "all" sends the data to all Targets(every Influxdb, Elasticsearch...)
# a certain name will direct the data to this certain target
DefaultTarget = "all"

[Log]

leave empty for stdout

LogFile = "/usr/local/nagflux/nagflux.log"
# List of Severities https://godoc.org/github.com/kdar/factorlog#Severity

MinSeverity = "INFO"

MinSeverity = "DEBUG"

[Monitoring]

leave empty to disable

# PrometheusAddress = ":8080"
PrometheusAddress = ":8080"

[Livestatus]

tcp or file

Type = "file"
# tcp: 127.0.0.1:6557 or file /var/run/live
Address = "/var/cache/naemon/live"
# The amount to minutes to wait for livestatus to come up, if set to 0 the detection is disabled
MinutesToWait = 2
# Set the Version of Livestatus. Allowed are Nagios, Icinga2, Naemon.
# If left empty Nagflux will try to detect it on it's own, which will not always work.
Version = "Naemon"

[ModGearman "example"] #copy this block and rename it to add a second ModGearman queue Enabled = false Address = "127.0.0.1:4730" Queue = "perfdata"

Leave Secret and SecretFile empty to disable encryption

# If both are filled the the Secret will be used
# Secret to encrypt the gearman jobs
Secret = ""
# Path to a file which holds the secret to encrypt the gearman jobs
SecretFile = "/etc/mod-gearman/secret.key"
Worker = 1

[InfluxDBGlobal] CreateDatabaseIfNotExists = true NastyString = "" NastyStringToReplace = "" HostcheckAlias = "hostcheck"

[InfluxDB "nagflux"] Enabled = true Version = 1.0 Address = "http://wb3.mydomain.hk:8086" Arguments = "precision=ms&u=nagflux&p=abcd1234&db=nagflux" StopPullingDataIfDown = true

[InfluxDB "fast"] Enabled = false Version = 1.0 Address = "http://127.0.0.1:8086" Arguments = "precision=ms&u=root&p=root&db=fast" StopPullingDataIfDown = false

[ElasticsearchGlobal] HostcheckAlias = "hostcheck" NumberOfShards = 1 NumberOfReplicas = 1

Sorts the indices "monthly" or "yearly"

IndexRotation = "monthly"

[Elasticsearch "example"] Enabled = false Address = "http://localhost:9200" Index = "nagflux" Version = 2.1

[JSONFileExport "one"] Enabled = false Path = "export/json"

Timeinterval in Seconds till a new file will be used. 0 for no rotation.

# If no rotation is selected, the JSON Objects are appended line by line so,
#   every single line is valid JSON but the whole file not.
# If rotation is selected every file as whole is valid JSON.
AutomaticFileRotation = "10"

--- cut here ---

I'm afraid if we've something missed. Please help.

Thanks a lot.

stwongst commented 1 year ago

We did have something missed in the setup. It's fixed now. Sorry about that. Thanks.