nagflux icon indicating copy to clipboard operation
nagflux copied to clipboard

Nothing in influx DB

Open Jugulaire opened this issue 6 years ago • 8 comments

Hi,

I'm trying to install nagflux on my nagios machine.

Here is my parameters :

`[root@JXT-NAGIOS ~]# cat config.gcfg [main] NagiosSpoolfileFolder = "/usr/local/nagios/var/spool/" NagiosSpoolfileWorker = 1 InfluxWorker = 2 MaxInfluxWorker = 5 DumpFile = "nagflux.dump" NagfluxSpoolfileFolder = "/usr/local/nagios/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 = "" #List of Severities https://godoc.org/github.com/kdar/factorlog#Severity MinSeverity = "DEBUG"

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

[Livestatus] # tcp or file Type = "tcp" # tcp: 127.0.0.1:6557 or file /var/run/live Address = "127.0.0.1:6557" # 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 = "Nagios"

[InfluxDB "nagflux"] Enabled = true Address = "http://192.168.2.116:8086" Arguments = "precision=ms&db=nagflux" StopPullingDataIfDown = true ` When i launch nagflux, everything seem to be okay :

[root@JXT-NAGIOS ~]# ./nagflux 2017-09-13 17:22:38 Info: Started Nagflux v0.4.1 2017-09-13 17:22:38 Debug: Using Config: config.gcfg 2017-09-13 17:22:38 Info: Is InfluxDB(nagflux) running: true 2017-09-13 17:22:38 Debug: Influxdb(nagflux) is running 2017-09-13 17:22:38 Debug: Dumpfile: nagflux.dump-nagflux.influx not found, skipping... (Everything is fine) 2017-09-13 17:22:38 Debug: DumpfileCollector stopped 2017-09-13 17:22:40 Info: Setting Livestatus version to: Nagios 2017-09-13 17:22:40 Info: Nagios Spoolfile Folder: /usr/local/nagios/var/spool/ 2017-09-13 17:22:40 Info: Nagflux Spoolfile Folder: /usr/local/nagios/var/spool/nagflux 2017-09-13 17:22:45 Debug: Reading Directory: /usr/local/nagios/var/spool/ 2017-09-13 17:22:50 Debug: Reading Directory: /usr/local/nagios/var/spool/ 2017-09-13 17:22:55 Debug: Reading Directory: /usr/local/nagios/var/spool/ 2017-09-13 17:23:00 Debug: Reading Directory: /usr/local/nagios/var/spool/ But obviously, i have no data in my influxdb base .. influxDB is 0.9.5.

Can you help me ?

Jugulaire avatar Sep 13 '17 15:09 Jugulaire

Hi, seams like you do not have any spoolfiles in your "/usr/local/nagios/var/spool/" folder. There should be a output like this:

2017-09-14 08:43:39 Debug: Reading Directory: /omd/sites/dummy/var/pnp4nagios/spool
2017-09-14 08:43:39 Debug: Reading file: /omd/sites/dummy/var/pnp4nagios/spool/host-perfdata.1505309572
2017-09-14 08:43:39 Debug: Reading file: /omd/sites/dummy/var/pnp4nagios/spool/host-perfdata.1505371402
2017-09-14 08:43:39 Debug: Reading file: /omd/sites/dummy/var/pnp4nagios/spool/service-perfdata.1505309572
2017-09-14 08:43:39 Debug: Reading file: /omd/sites/dummy/var/pnp4nagios/spool/service-perfdata.1505371402

Griesbacher avatar Sep 14 '17 06:09 Griesbacher

Hi,

I've changed my conf and now i get something from the spool file but influxdb still empty. The db is créated but nothing into ...

My nagios seem to does not create file in my spool .. I've also tried to use livestatus, configured ans tested but nagflux seem to not using it ..

Here is my configuration :

`[root@JXT-NAGIOS ~]# cat config.gcfg [main] NagiosSpoolfileFolder = "/usr/local/nagios/var/spool/checkresults" NagiosSpoolfileWorker = 1 InfluxWorker = 2 MaxInfluxWorker = 5 DumpFile = "nagflux.dump" NagfluxSpoolfileFolder = "/usr/local/nagios/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 = "InfluxDB"

[Log] #leave empty for stdout LogFile = "" #List of Severities https://godoc.org/github.com/kdar/factorlog#Severity MinSeverity = "DEBUG"

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

[Livestatus] # tcp or file Type = "tcp" # tcp: 127.0.0.1:6557 or file /var/run/live Address = "127.0.0.1:6557" # 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 = "Nagios"

[InfluxDB "nagflux"] Enabled = true Version = 0.9.5 Address = "http://127.0.0.1:8086" Arguments = "precision=ms&db=nagflux&u=nagflux&p=nagflux" StopPullingDataIfDown = true ` Here is a quick test of livestatus :

nc 127.0.0.1 6557 < hosts.lql accept_passive_checks;acknowledged;acknowledgement_type;action_url;action_url_expanded;active_checks_enabled;address;alias;check_command;check_command_expanded;check_flapping_recovery_notification;check_freshness;check_interval;check_options;check_period;check_type;checks_enabled;childs;comments;comments_with_extra_info;comments_with_info;contact_groups;contacts;current_attempt;current_notification_number;custom_variable_names;custom_variable_values;custom_variables;display_name;downtimes;downtimes_with_info;event_handler;event_handler_enabled;execution_time;filename;first_notification_delay;flap_detection_enabled;groups;hard_state;has_been_checked;high_flap_threshold;icon_image;icon_image_alt;icon_image_expanded;in_check_period;in_notification_period;in_service_period;initial_state;is_executing;is_flapping;last_check;last_hard_state;last_hard_state_change;last_notification;last_state;last_state_change;last_time_down;last_time_unreachable;last_time_up;latency;long_plugin_output;low_flap_threshold;max_check_attempts;mk_inventory;mk_inventory_gz;mk_inventory_last;modified_attributes;modified_attributes_list;name;next_check;next_notification;no_more_notifications;notes;notes_expanded;notes_url;notes_url_expanded;notification_interval;notification_period;notifications_enabled;num_services;num_services_crit;num_services_hard_crit;num_services_hard_ok;num_services_hard_unknown;num_services_hard_warn;num_services_ok;num_services_pending;num_services_unknown;num_services_warn;obsess_over_host;parents;pending_flex_downtime;percent_state_change;perf_data;plugin_output;pnpgraph_present;process_performance_data;retry_interval;scheduled_downtime_depth;service_period;services;services_with_fullstate;services_with_info;services_with_state;staleness;state;state_type;statusmap_image;total_services;worst_service_hard_state;worst_service_state;x_3d;y_3d;z_3d Here is the log after launching :

[root@JXT-NAGIOS ~]# ./nagflux 2017-09-14 12:10:06 Info: Started Nagflux v0.4.1 2017-09-14 12:10:06 Debug: Using Config: config.gcfg 2017-09-14 12:10:06 Info: Is InfluxDB(nagflux) running: true 2017-09-14 12:10:06 Debug: Influxdb(nagflux) is running 2017-09-14 12:10:06 Debug: Dumpfile: nagflux.dump-nagflux.influx not found, skipping... (Everything is fine) 2017-09-14 12:10:06 Debug: DumpfileCollector stopped 2017-09-14 12:10:08 Info: Setting Livestatus version to: Nagios 2017-09-14 12:10:08 Info: Nagios Spoolfile Folder: /usr/local/nagios/var/spool/checkresults 2017-09-14 12:10:08 Info: Nagflux Spoolfile Folder: /usr/local/nagios/var/spool/nagflux 2017-09-14 12:10:13 Debug: Reading Directory: /usr/local/nagios/var/spool/checkresults 2017-09-14 12:10:18 Debug: Reading Directory: /usr/local/nagios/var/spool/checkresults

Thanks for helping !

Jugulaire avatar Sep 14 '17 10:09 Jugulaire

Livestatus is ~~not~~ nice to have but not necessary to write your data to the InfluxDB. You need your spoolfiles configured, which seems not. There have to files in your "/usr/local/nagios/var/spool/checkresults", which seems not, at least you posted no entry like the one I did. You need to configure your Monitoring Core the right way, to write your spoolfiles in this folder.

You should also add the following block to your config, but that's not your problem:

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

Griesbacher avatar Sep 14 '17 10:09 Griesbacher

"is not nice to have"? ;-)

sni avatar Sep 14 '17 10:09 sni

The spool file is configured in nagios but still nothing into ...

Jugulaire avatar Sep 14 '17 12:09 Jugulaire

@sni yeah that's kinda wrong :-D it's fixed @Jugulaire so that is indicating, your nagios config is missing your perdata. Maybe you should take a lot into OMD and this article (it's in German but pretty self explaining), it explains how you configure OMD to write into InfluxDB with Grafana.

Griesbacher avatar Sep 14 '17 13:09 Griesbacher

I'm not using OMD, I'm just trying to make a dashboard with grafana from an old nagios 4.1.1

Jugulaire avatar Sep 14 '17 14:09 Jugulaire

Okay so after some investigation, i got a partial solution.

It's seem to be a problem with process-host-perfdata-file command. It's not set in command.cfg but i don't know how to set it.. Anybody can help me ? Maybe i just need to install pnp4nagios ?

Jugulaire avatar Sep 14 '17 15:09 Jugulaire