shawn-sterling / graphios

A program to send nagios perf data to graphite (carbon) / statsd / librato / influxdb
288 stars 100 forks source link

Processed 1 files (0 metrics) in /var/spool/nagios/graphios #136

Open mikimtm opened 7 years ago

mikimtm commented 7 years ago

This in the headline is mesage i get periodically, I have set up all correctly with setup.py and nagios is working fine.

Here is what I have in spool dir ls -la /var/spool/nagios/graphios/ total 0 drwxrwxrwx. 2 apache nagios 51 Mar 11 21:57 . drwxr-xr-x. 5 nagios nagios 113 Mar 11 21:58 .. -rw-r--r--. 1 nagios nagios 0 Mar 11 21:57 host-perfdata -rw-r--r--. 1 nagios nagios 0 Mar 11 21:57 service-perfdata

I tried changing ownership to dir to nagios and to apache, giving 777 rights, but that seems not to be the problem. Problem is that host-perfdata and service-perfdata have no metrics inside.

tail -f /var/spool/nagios/graphios/service-perfdata DATATYPE::SERVICEPERFDATA TIMET::1489270283 HOSTNAME::localhostSERVICEDESC::Root Partition SERVICEPERFDATA::/=1225MB;9566;10762;0;11958 SERVICECHECKCOMMAND::check_local_disk!20%!10%!/ HOSTSTATE::UP HOSTSTATETYPE::HARD SERVICESTATE::OK SERVICESTATETYPE::HARD GRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$ GRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$ METRICTYPE::$_SERVICEMETRICTYPE$

tail -f /var/spool/nagios/graphios/host-perfdata

^C

host-perfdata is empty and service-perfdata is not but no metrics.

What to do from here?

Colkard commented 7 years ago

I have same problem. Here is my spool dir:

[root@centos6-8 graphios]# ls -la /var/spool/nagios/graphios total 16 drwxrwxrwx 2 root root 12288 sep 13 12:14 . drwxrwxrwx 4 root root 4096 sep 6 17:03 .. -rw-r--r-- 1 nagios nagios 0 sep 13 12:14 host-perfdata.1505297666 -rw-r--r-- 1 nagios nagios 0 sep 13 12:14 host-perfdata.1505297680 -rw-r--r-- 1 nagios nagios 0 sep 13 12:14 host-perfdata.1505297696 And here is how a perfdata file looks like:

tail -f /var/spool/nagios/graphios/host-perfdata.1505297*

/var/spool/nagios/graphios/host-perfdata.1505297936 <== DATATYPE::HOSTPERFDATA TIMET::1505297934 HOSTNAME::localhost HOSTPERFDATA::rta=0.098000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0 HOSTCHECKCOMMAND::check-host-alive 1505297930 localhost UP 1 HARD 4.007 PING OK - Packet loss = 0%, RTA = 0.10 ms rta=0.098000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0

I also have this dir with perfdata: ls -la /usr/local/nagios/var/spool/nagfluxperfdata/ that looks like: image

[root@centos6-8 graphios]# ls -la /usr/local/nagios/var/spool/nagfluxperfdata/ total 16 drwxrwxrwx. 2 nagios nagios 4096 sep 13 12:22 . drwxrwxrwx. 4 root root 4096 sep 5 13:45 .. -rw-r--r-- 1 nagios nagios 5222 sep 13 12:21 service-perfdata.out

And this is the output on if i setup as spool directory any of those: ./graphios.py --config=graphios.cfg --verbose

deleted /var/spool/nagios/graphios/host-perfdata.1505297861 deleted /var/spool/nagios/graphios/host-perfdata.1505297881 Processed 2 files (0 metrics) in /var/spool/nagios/graphios/ graphios sleeping.

My graphios.cfg file:

# Graphios config file

[graphios]

#------------------------------------------------------------------------------ # Global Details (you need these!) #------------------------------------------------------------------------------

# Character to use as replacement for invalid characters in metric names replacementcharacter =

# nagios spool directory # spool_directory = /usr/local/nagios/var/spool/nagfluxperfdata/ spool_directory = /var/spool/nagios/graphios/

# graphios log info log_file = /usr/local/nagios/var/graphios.log

# max log size in megabytes (it will rotate the files) log_max_size = 24

# available log levels: # DEBUG, INFO, WARNING, ERROR, CRITICAL # see https://docs.python.org/2/library/logging.html#logging-levels for details # DEBUG is quite verbose #log_level = logging.DEBUG log_level = logging.INFO

# Disable this once you get it working. debug = True

# How long to sleep between processing the spool directory sleep_time = 15

# when we can't connect to carbon, the sleeptime is doubled until we hit max sleep_max = 480

# test mode makes it so we print what we would add to carbon, and not delete # any files from the spool directory. log_level must be DEBUG as well. test_mode = False

# use service description, most people will NOT want this, read documentation! use_service_desc = False

# replace "." in nagios hostnames? (so "my.host.name" becomes "my_host_name") # (uses the replacement_character) replace_hostname = True

# reverse hostname # if you have: # host.datacenter.company.tld # as your nagios hostname you may prefer to have your metric stored as: # tld.company.datacenter.host reverse_hostname = False

# This string will be universally pre-pended to metrics, regardless of whether # or not _graphiteprefix is set. (Quotes not required). # metric_base_path = mycorp.nagios

#------------------------------------------------------------------------------ # Carbon Details (comment out if not using carbon) #------------------------------------------------------------------------------

#enable_carbon = False

# Defaults to using the pickle protocol. Set to True to use the plaintext protocol. #carbon_plaintext = False

# Comma separated list of carbon server IP:Port 's #carbon_servers = 127.0.0.1:2004

# The max amount of metrics to send to the carbon server at a time (def:200) #carbon_max_metrics = 200

#flag the carbon backend as 'non essential' for the purposes of error checking #nerf_carbon = False

#------------------------------------------------------------------------------ # Statsd Details (comment in if you are using statsd) #------------------------------------------------------------------------------

#enable_statsd = False

# Comma separated list of statsd server IP:Port 's #statsd_servers = 127.0.0.1:8125

#flag the statsd backend as 'non essential' for the purposes of error checking #nerf_statsd = False

#------------------------------------------------------------------------------ # librato Details (comment in if you are using librato) #------------------------------------------------------------------------------

#enable_librato = False

# your (required) librato credentials here: #librato_email = #librato_token =

#### ZOMG SUPER IMPORTANT SETTING THAT WILL SAVE YOU MONEY ##### # json-formmated RE patterns that match the names of metrics you want to emit # to Librato the default list is ["."] (send everything). # Example: # librato_whitelist = ["load","rta","swap"] #librato_whitelist = ["."]

#OPTIONAL BELOW HERE, LEAVE COMMENTED UNLESS YOU REALLY WANT IT CHANGED

# floor_time_secs: Floor samples to this time (set to graphios sleep_time)

librato_floor_time_secs = 15

# comma separated list of Nagios Macros we use to construct the metric name: # librato_namevals = GRAPHITEPREFIX,SERVICEDESC,GRAPHITEPOSTFIX,LABEL

# comma separated list of Nagios Macros we use to construct the source value : # librato_sourcevals = HOSTNAME

#flag the librato backend as 'non essential' for the purposes of error checking #nerf_librato = False

#------------------------------------------------------------------------------ # InfluxDB Details (if you are using InfluxDB 0.8) #------------------------------------------------------------------------------

enable_influxdb = False

#------------------------------------------------------------------------------ # InfluxDB Details (if you are using InfluxDB 0.9) # This will work a bit differently because of the addition of tags in # InfluxDB 0.9. Now the metric will be named after the service description, # the perfdata field will be a tag, and the host name will be a tag. The value # of the metric is stored in the 'value' column. # Requires use_service_desc = True. #------------------------------------------------------------------------------

enable_influxdb09 = True

# Extra tags to add to metrics, like data center location etc. # Only valid for 0.9 #influxdb_extra_tags = {"location": "la"}

# Comma separated list of server:ports # defaults to 127.0.0.1:8086 (:8087 if using SSL). influxdb_servers = http://[::1]:8086

# SSL, defaults to False #influxdb_use_ssl = True

# Database-name, defaults to nagios influxdb_db = graphios

# Credentials (required) influxdb_user = root influxdb_password = root

# Max metrics to send / request, defaults to 250 influxdb_max_metrics = 500

# Flag the InfluxDB backend as 'non essential' for the purposes of error checking #nerf_influxdb = False

# enable Line Protocol, defaults to False #influxdb_line_protocol = True

#------------------------------------------------------------------------------ # STDOUT Details (comment in if you are using STDOUT) #------------------------------------------------------------------------------

#comment the line below to disable the STDOUT sender enable_stdout = False

#flag the stdout backend as 'non essential' for the purposes of error checking nerf_stdout = True InfluxDB version: influx

http://localhost:8086 version 0.9.5.1 And my database and measurements:

> use graphios Using database graphios > show measurements >

Please help, I spent like a week installing and reinstalling all (nagios, influxdb and grafana) configuring all, trying other libraries like nagflux or fluxios and not succeded with any. Thank you all for reading!

mikimtm commented 7 years ago

My problem was fixed when i set up the graphite prefix for every metric I needed. I no longer have access to the setup, can't share configs.

Colkard commented 7 years ago

Thank you so much!