{"id":13530001,"url":"https://github.com/shawn-sterling/graphios","last_synced_at":"2026-04-08T15:32:41.563Z","repository":{"id":1935311,"uuid":"2864214","full_name":"shawn-sterling/graphios","owner":"shawn-sterling","description":"A program to send nagios perf data to graphite (carbon) / statsd / librato / influxdb","archived":false,"fork":false,"pushed_at":"2017-07-27T19:11:24.000Z","size":460,"stargazers_count":289,"open_issues_count":47,"forks_count":100,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-04-26T09:04:22.187Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shawn-sterling.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-28T02:03:59.000Z","updated_at":"2023-09-08T16:31:20.000Z","dependencies_parsed_at":"2022-08-03T18:45:25.404Z","dependency_job_id":null,"html_url":"https://github.com/shawn-sterling/graphios","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawn-sterling%2Fgraphios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawn-sterling%2Fgraphios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawn-sterling%2Fgraphios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawn-sterling%2Fgraphios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shawn-sterling","download_url":"https://codeload.github.com/shawn-sterling/graphios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246680322,"owners_count":20816676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:41.945Z","updated_at":"2025-12-13T16:46:34.938Z","avatar_url":"https://github.com/shawn-sterling.png","language":"Python","funding_links":[],"categories":["Collecting data into InfluxDB","Nagios Monitoring"],"sub_categories":["Projects","Nagios Monitoring Addons"],"readme":"\nGraphios\n========\n\n[![Build Status](https://travis-ci.org/shawn-sterling/graphios.svg?branch=master)](https://travis-ci.org/shawn-sterling/graphios)\n\n*Oct 15, 2014*\n\nNew graphios 2.0!\n\nWhat's new?\n* Support for multiple backends (graphite, statsd, librato) (and multiples of\n  each backend if you want)\n* Support for using your service descriptions instead of custom variables\n* Install options (pip, setup.py, rpms)\n* Bugfixes\n  * mulitple perfdata in 1 line sometimes did weird things\n  * quotes in your labels/metrics were sometimes in carbon\n  * labels with multiple '::' could mess up\n\n# Introduction\n\nGraphios is a script to emit nagios perfdata to various upstream metrics\nprocessing and time-series (graphing) systems. It's currently compatible with\n[graphite], [statsd], [Librato] and [InfluxDB], with possibly [Heka], and\n[RRDTool] support coming soon. Graphios can emit Nagios metrics to any number\nof supported upstream metrics systems simultaenously.\n\n# Requirements\n\n* A working nagios / icinga / naemon server\n* A functional carbon or statsd daemon, and/or Librato credentials\n* Python 2.6 or later (but not python 3.x) (Is anyone still using 2.4? Likely\nvery little work to make this work under 2.4 again if so. Let me know)\n\n# License\n\nGraphios is released under the [GPL v2](http://www.gnu.org/licenses/gpl-2.0.html).\n\n# Documentation\n\nThe goal of graphios is to get nagios perf data into a graphing system like\ngraphite (carbon). Systems like these typically use a dot-delimited metric name\nto store each metric hierarcicly, so it can be easily located later.\n\nGraphios creates these metric names one of two ways.\n\n1. by reading a pair of custom variables that\nyou configure for services and hosts called \\_graphiteprefix and\n\\_graphitepostfix.  Together, these custom variables enable you to control the\nmetric name that gets sent to whatever back-end metrics system you're using.\nYou don't have to set them both, but things will certainly be less confusing\nfor you if you set at least one or the other.\n\n2. by using your service description in the format:\n\n\\_graphiteprefix.hostname.service-description.\\_graphitepostfix.perfdata\n\nso if you didn't feel like setting your graphiteprefix and postfix, it would\njust use:\n\nhostname.service-description.perfdata\n\nIf you are using option 2, that means EVERY service will be sent to graphite.\nYou will also want to make sure your service descriptions are consistant or\nyour backend naming will be really weird.\n\nI think most people will use the first option, so let's work with that for a\nbit. What gets sent to graphite is this:\n\ngraphiteprefix.hostname.graphitepostfix.perfdata\n\nThe specific content of the perfdata section depends on each particular Nagios\nplugin's output.\n\nSimple Example\n--------------\n\nA simple example is the check\\_host\\_alive command (which calls the check\\_icmp\nplugin by default). The check\\_icmp plugin returns the following perfstring:\n\nrta=4.029ms;10.000;30.000;0; pl=0%;5;10;; rtmax=4.996ms;;;; rtmin=3.066ms;;;;\n\nIf we configured a host with a custom graphiteprefix variable like this:\n\n\u003cpre\u003e\ndefine host {\n    host_name                   myhost\n    check_command               check_host_alive\n    _graphiteprefix             ops.nagios01.pingto\n}\n\u003c/pre\u003e\n\nGraphios will construct and emit the following metric name to the upstream metric system:\n\n    ops.nagios01.pingto.myhost.rta 4.029 nagios_timet\n    ops.nagios01.pingto.myhost.pl 0 nagios_timet\n    ops.nagios01.pingto.myhost.rtmax 4.996 nagios_timet\n    ops.nagios01.pingto.myhost.rtmin 3.066 nagios_timet\n\nWhere *nagios\\_timet* is the a unix epoch time stamp from when the plugin\nresults were received by Nagios core.  Your prefix is of course, entirely up to\nyou. In our example, our prefix refers to the Team that created the metric\n(Ops), becuause our upstream metrics system is used by many different teams.\nAfer the team name, we've identified the specific Nagios host that took this\nmeasurement, because we actually have several Nagios boxes, and finally,\n'pingto' is the name of this specific metric: the *ping* time from nagios01\n*to* myhost.\n\nAnother example\n---------------\n\nLets take a look at the check_load plugin, which returns the following\nperfdata:\n\nload1=8.41;20;22;; load5=6.06;18;20;; load15=5.58;16;18\n\nOur service is defined like this:\n\n\u003cpre\u003e\ndefine service {\n    service_description         Load\n    host_name                   myhost\n    _graphiteprefix             datacenter01.webservers\n    _graphitepostfix            nrdp.load\n}\n\u003c/pre\u003e\n\nWith this confiuration, graphios generates the following metric names:\n\n    datacenter01.webservers.myhost.nrdp.load.load1 8.41 nagios_timet\n    datacenter01.webservers.myhost.nrdp.load.load5 6.06 nagios_timet\n    datacenter01.webservers.myhost.nrdp.load.load15 5.58 nagios_timet\n\nAs you can probably guess, our custom prefix in this example identifies the\nspecific data center, and server-type from which these metrics originated,\nwhile our postfix refers to the check_nrdp plugin, which is the means by which\nwe collected the data, followed finally by the metric-type.\n\nYou should think carefully about how you name your metrics, because later on,\nthese names will enable you to easily combine metrics (like load1) across\nvarious sources (like all webservers).\n\nUsing metric_base_path to add a universal prefix\n------------------------------------------------\n\nIn an environment where multiple things are feeding metrics into your backend\nservice, it can be handy to differentiate by source. Normally, you would need\nto prepend the graphiteprefix to all services and hosts, but in some cases, this\nisn't possible or feasible. \n\nWhen you want everything to be prepended with the same string, use the\nmetric_base_path setting: \n\n\tmetric_base_path\t= mycorp.nagios\n\t\nNote that quotes will be preserved. Also, _graphiteprefix and _graphitepostfix \nwill be applied in addition to this string, so if you are already adding \nmycorp.nagios to your prefix, you will end up with mycorp.nagios.mycorp.nagios.metricname\n\nA few words on Naming things for Librato\n----------------------------------------\n\nThe default configuration that works for Graphite also does what you'd expect\nfor Librato, so if you're just getting started, and you want to check out\nLibrato, don't worry about it, ignore this section and forge ahead.\n\nBut you're a power user, you should be aware that the Librato Backend is\nactually generating a differet metric name than the other plugins.\nLibrato is a very metrics-centric platform. Metrics are the first-class entity,\nand sources (like hosts), are actually a separate dimension in their system.\nThis is very cool when you're monitoring ephemeral things that aren't hosts,\nlike threads, or worker processes, but it slightly complicates things here.\n\nSo, for example, where the Graphite plugin generates a name like this (from the\nexample above):\n\n    datacenter01.webservers.myhost.nrdp.load.load1\n\nThe Librato plugin will generate a name that omits the hostname:\n\n    datacenter01.webservers.nrdp.load.load1\n\nAnd then it will automatically send the hostname as the source dimension when\nit emits the metric to Librato. For 99% of everyone, this is exactly what you\nwant. But if you're a 1%'er you can influence this behavior by modifying the\n\"namevals\" and \"sourcevals\" lists in the librato section of the graphios.cfg\n\nAutomatic names\n---------------\n\nVersion 2.0: Graphios now supports automatic names, because custom variables\nare hard. :)\n\nThis is an all or nothing setting, meaning if you turn this on all services\nwill now send to graphios (instead of just the ones with the prefix and postfix\nsetup). This will work fine, so long as you have very consistent service\ndescriptions.\n\nTo turn this on, modify the graphios.cfg and change:\n\n    use_service_desc = False\nto\n    use_service_desc = True\n\nYou can still use the graphite prefix and postfix variables but you don't have\nto.\n\n# Big Fat Warning\n\nGraphios assumes your checks are using the same unit of measurement. Most\nplugins support this, some do not. check\\_icmp) always reports in ms for\nexample.\n\n# Installation\n\nThis is recommended for intermediate+ Nagios administrators. If you are just\nlearning Nagios this might be a difficult pill to swallow depending on your\nexperience level.\n\nHundreds of people have emailed me their success stories on getting graphios\nworking. I have been using this in production on a medium size nagios\ninstallation for a couple years.\n\nThere are now a few ways to get graphios installed.\n\n1 - Use pypi\n\n```\n    pip install graphios\n```\n    NOTE: This will attempt to find your nagios.cfg and add the configuration\n    steps 1 and 2 for you (Don't worry we back up the file before touching it)\n\n    NOTE2: If you get the error:\n    Could not find a version that satisfies the requirement graphios\n    This is a because graphios is still in the beta category. I will remove\n    this in a few weeks, so until then you need to:\n\n```\n    pip install --pre graphios\n```\n\n2 - Clone it yourself\n\n```\n    git clone https://github.com/shawn-sterling/graphios.git\n    cd graphios\n```\n\nThen do one of the following three things (depending what you like best):\n\n  1 - Python setup\n\n```\n    python setup.py install\n```\n\n  2 - Create + Install RPM\n\n```\n    python setup.py bdist_rpm\n    yum localinstall bdist/graphios-$version.rpm\n```\n\n  3 - Copy the files where you want them to be\n\n```\n    cp graphios*.py /my/dir\n    cp graphios.cfg /my/dir\n```\n\n# Configuration\n\nSetting this up on the nagios front is very much like pnp4nagios with npcd.\n(You do not need to have any pnp4nagios experience at all). If you are already\nrunning pnp4nagios , check out my pnp4nagios notes (below).\n\nSteps:\n\n(1) graphios.cfg\n----------------\n\nThe default location for graphios.cfg is in /etc/graphios/graphios.cfg, it\nalso checks the same directory as the graphios.py is.\n\nYour graphios.cfg can live anywhere you want, but if it's not in the above\nlocations you will need to modify your init script to match.\n\nOut of the box, it enables the carbon back-end and sends pickled metrics to\n127.0.0.1:2004.  It also specifies the location of the graphios log and spool\ndirectories, and controls things like log levels, sleep intervals, and of\ncourse, backends like carbon, statsd, and librato.\n\nThe config file is well commented, adding/changing backends is very simple.\n\n(2) nagios.cfg\n--------------\n\nYour nagios.cfg is going to need to modified to send the graphite data to the\nperfdata files. Depending on how you installed graphios this step may have been\ndone for you.\n\nThe following needs to be put into your nagios.cfg\n\u003cpre\u003e\nservice_perfdata_file=/var/spool/nagios/graphios/service-perfdata\nservice_perfdata_file_template=DATATYPE::SERVICEPERFDATA\\tTIMET::$TIMET$\\tHOSTNAME::$HOSTNAME$\\tSERVICEDESC::$SERVICEDESC$\\tSERVICEPERFDATA::$SERVICEPERFDATA$\\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\\tHOSTSTATE::$HOSTSTATE$\\tHOSTSTATETYPE::$HOSTSTATETYPE$\\tSERVICESTATE::$SERVICESTATE$\\tSERVICESTATETYPE::$SERVICESTATETYPE$\\tGRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$\\tGRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$\n\nservice_perfdata_file_mode=a\nservice_perfdata_file_processing_interval=15\nservice_perfdata_file_processing_command=graphite_perf_service\n\nhost_perfdata_file=/var/spool/nagios/graphios/host-perfdata\nhost_perfdata_file_template=DATATYPE::HOSTPERFDATA\\tTIMET::$TIMET$\\tHOSTNAME::$HOSTNAME$\\tHOSTPERFDATA::$HOSTPERFDATA$\\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\\tHOSTSTATE::$HOSTSTATE$\\tHOSTSTATETYPE::$HOSTSTATETYPE$\\tGRAPHITEPREFIX::$_HOSTGRAPHITEPREFIX$\\tGRAPHITEPOSTFIX::$_HOSTGRAPHITEPOSTFIX$\n\nhost_perfdata_file_mode=a\nhost_perfdata_file_processing_interval=15\nhost_perfdata_file_processing_command=graphite_perf_host\n\u003c/pre\u003e\n\nWhich sets up some custom variables, specifically:\nfor services:\n$\\_SERVICEGRAPHITEPREFIX\n$\\_SERVICEGRAPHITEPOSTFIX\n\nfor hosts:\n$\\_HOSTGRAPHITEPREFIX\n$\\_HOSTGRAPHITEPOSTFIX\n\nThe prepended HOST and SERVICE is just the way nagios works,\n\\_HOSTGRAPHITEPREFIX means it's the \\_GRAPHITEPREFIX variable from host\nconfiguration.\n\n(3) nagios commands\n-------------------\n\nThere are 2 commands we setup in the nagios.cfg, which if you used pip or the\nrpm/deb may have already been setup for you. We need:\n\n    graphite\\_perf\\_service\n    graphite\\_perf\\_host\n\nWhich we now need to define:\n\nI use include dirs, so I make a new file called graphios\\_commands.cfg inside\nmy include dir. Do that, or add the below commands to one of your existing\nnagios config files.\n\n#### NOTE: Your spool directory may be different, this is setup in step (2) the service_perfdata_file, and host_perfdata_file.\n\n\u003cpre\u003e\ndefine command {\n    command_name            graphite_perf_host\n    command_line            /bin/mv /var/spool/nagios/graphios/host-perfdata /var/spool/nagios/graphios/host-perfdata.$TIMET$\n\n}\n\ndefine command {\n    command_name            graphite_perf_service\n    command_line            /bin/mv /var/spool/nagios/graphios/service-perfdata /var/spool/nagios/graphios/service-perfdata.$TIMET$\n}\n\u003c/pre\u003e\n\nAll these commands do is move the current files to a different filename that we can process without interrupting nagios. This way nagios doesn't have to sit around waiting for us to process the results.\n\n(4) Run it!\n---------------\n\nWe recommend running graphios.py from the console for the first time, this will\nmake sure things are sending the way you think they are. A good example would\nbe:\n\n    ./graphios.py --spool-directory /var/spool/nagios/graphios \\\n    --log-file /tmp/graphios.log \\\n    --backend carbon \\\n    --server 127.0.0.1:2004 \\\n    --test\n\nand if there are problems add\n\n    --verbose\n\nOther command line options:\n\u003cpre\u003e\nUsage: graphios.py [options]\nsends nagios performance data to carbon.\n\nOptions:\n  -h, --help            show this help message and exit\n  -v, --verbose         sets logging to DEBUG level\n  --spool-directory=SPOOL_DIRECTORY\n                        where to look for nagios performance data\n  --log-file=LOG_FILE   file to log to\n  --backend=BACKEND     sets which storage backend to use\n  --config=CONFIG       set custom config file location\n  --test                Turns on test mode, which won't send to backends\n  --replace_char=REPLACE_CHAR\n                        Replacement Character (default '_'\n  --sleep_time=SLEEP_TIME\n                        How much time to sleep between checks\n  --sleep_max=SLEEP_MAX\n                        Max time to sleep between runs\n  --server=SERVER       Server address (for backend)\n  --no_replace_hostname\n                        Replace '.' in nagios hostnames, default on.\n  --reverse_hostname    Reverse nagios hostname, default off.\n\n)\n\u003c/pre\u003e\n\n** NOTE: If you use --config on the command line, we ignore every other\ncommand line, your --config will overwrite everything else.\n\n(5) Optional init script: graphios\n----------------------------------\n\nRemember: *screen* is not a daemon management tool.\n\nIf you installed with pip/setup.py/rpm this part should be done for you!\n\nTake a look in the init/ directory and find your OS of choice.\n\nFor debian/ubuntu:\n    cp init/debian/graphios /etc/init.d/\n    cp init/debian/graphios.conf /etc/init\n    chmod 755 /etc/init.d/graphios\n\nFor rhel/centos/sl \u003c 6:\n    cp init/rhel/graphios /etc/init.d\n    chmod 755 /etc/init.d/graphios\n\nfor systems with systemd:\n    cp init/systemd/graphios.service /usr/lib/systemd/system\n\n#### NOTE: You may need to change the location and username that the script runs as. this varies slightly depending on where you decided to put graphios.py\n\nThe lines you will likely have to change:\n\u003cpre\u003e\nprog=\"/opt/nagios/bin/graphios.py\"\n# or use the command line options:\n#prog=\"/opt/nagios/bin/graphios.py --log-file=/dir/mylog.log --spool-directory=/dir/my/sool\"\nGRAPHIOS_USER=\"nagios\"\n\u003c/pre\u003e\n\n(6) Your host and service configs\n---------------------------------\n\nOnce you have done the above you need to add a custom variable to the hosts and\nservices that you want sent to graphite. (Unless you are using service\ndescriptions, in which case you can skip this step)\n\nThe format that will be sent to carbon is:\n\n\u003cpre\u003e\n_graphiteprefix.hostname._graphitepostfix.perfdata\n\u003c/pre\u003e\n\nYou do not need to set both graphiteprefix and graphitepostfix. Just one or the\nother will do. If you do not set at least one of them, the data will not be\nsent to graphite at all (unless you are using the service descriptions)\n\nExamples:\n\n\u003cpre\u003e\ndefine host {\n    name                        myhost\n    check_command               check_host_alive\n    _graphiteprefix             monitoring.nagios01.pingto\n}\n\u003c/pre\u003e\n\nWhich would create the following graphite entries with data from the check\\_host\\_alive plugin:\n\n    monitoring.nagios01.pingto.myhost.rta\n    monitoring.nagios01.pingto.myhost.rtmin\n    monitoring.nagios01.pingto.myhost.rtmax\n    monitoring.nagios01.pingto.myhost.pl\n\n\u003cpre\u003e\ndefine service {\n    service_description         MySQL threads connected\n    host_name                   myhost\n    check_command               check_mysql_health_threshold!threads-connected!3306!1600!1800\n    _graphiteprefix             monitoring.nagios01.mysql\n}\n\u003c/pre\u003e\n\nWhich gives us:\n\n    monitoring.nagios01.mysql.myhost.threads_connected\n\nSee the Documentation (above) for more explanation on how this works.\n\n\n# Upgrading\n\nTo upgrade from the old version of graphios, you need to:\n\n1. Look at the things you changed in the old graphios.py (carbon_server,\nspool_directory, log_file location, etc)\n2. Edit your new graphios.cfg and put those options there instead. You should\nNOT have to modify the new graphios.py.\n\n*Why Upgrade?*\n\nThe new version has fixed some bugs, and has cooler optional backends; and\nsupport for multiple backends, including multiple carbon servers. I don't think\nany major performance increases have been made, so if it isn't broken don't fix\nit.\n\n# PNP4Nagios Notes:\n\nAre you already running pnp4nagios? And want to just try this out and see if\nyou like it? Cool! This is very easy to do without breaking your PNP4Nagios\nconfiguration (but do a backup just in case).\n\nSteps:\n\n(1) In your nagios.cfg:\n-----------------------\n\nAdd the following at the end of your:\n\n\u003cpre\u003e\nhost_perfdata_file_template\n\\tGRAPHITEPREFIX::$_HOSTGRAPHITEPREFIX$\\tGRAPHITEPOSTFIX::$_HOSTGRAPHITEPOSTFIX$\n\nservice_perfdata_file_template\n\\tGRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$\\tGRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$\n\u003c/pre\u003e\n\nThis will add the variables to your check results, and will be ignored by pnp4nagios.\n\n(2) Change your commands:\n-------------------------\n\n(find your command names under host\\_perfdata\\_file\\_processing\\_command and service\\_perfdata\\_file\\_processing\\_command in your nagios.cfg)\n\nYou likely have 2 commands setup that look something like these two:\n\n\u003cpre\u003e\ndefine command{\n       command_name    process-service-perfdata-file\n       command_line    /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$\n}\n\ndefine command{\n       command_name    process-host-perfdata-file\n       command_line    /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$\n}\n\u003c/pre\u003e\n\nInstead of just moving the file; move it then copy it, then we can point graphios at the copy.\n\nYou can do this by either:\n\n(1) Change the command\\_line to something like:\n\n\u003cpre\u003e\ncommand_line    \"/bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$ \u0026\u0026 cp /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$ /usr/local/pnp4nagios/var/spool/graphios\"\n\u003c/pre\u003e\n\nOR\n\n(2) Make a script:\n\n\u003cpre\u003e\n#!/bin/bash\n/bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$\ncp /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$ /usr/local/pnp4nagios/var/spool/graphios\n\nchange the command_line to be:\ncommand_line    /path/to/myscript.sh\n\u003c/pre\u003e\n\nYou should now be able to skip steps 2 and 3 on the configuration instructions.\n\n# OMD (Open Monitoring Distribution) Notes:\n\nThese instructions are for OMD \u003e= 1.2x (including the current nightly builds).\n\n__Note:__ All steps below are assumed to be carried out under your OMD site's user.\n\n(1) Change PNP4NAGIOS to use \"NPCD with Bulk Mode\" instead of NPCDMOD. This is done by redirecting the symlink for pnp4nagios.cfg:\n\n\u003cpre\u003e\nln -sf ~/etc/pnp4nagios/nagios_npcd.cfg ~/etc/nagios/nagios.d/pnp4nagios.cfg\n\u003c/pre\u003e\n\n(2) Update ~/etc/pnp4nagios/nagios_npcd.cfg (remember to replace SITENAME).\n\n\u003cpre\u003e\n#\n# PNP4Nagios Bulk Mode with npcd\n#\nprocess_performance_data=1\n\n#\n# service performance data\n#\nservice_perfdata_file=/omd/sites/SITENAME/var/pnp4nagios/service-perfdata\nservice_perfdata_file_template=DATATYPE::SERVICEPERFDATA\\tTIMET::$TIMET$\\tHOSTNAME::$HOSTNAME$\\tSERVICEDESC::$SERVICEDESC$\\tSERVICEPERFDATA::$SERVICEPERFDATA$\\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\\tHOSTSTATE::$HOSTSTATE$\\tHOSTSTATETYPE::$HOSTSTATETYPE$\\tSERVICESTATE::$SERVICESTATE$\\tSERVICESTATETYPE::$SERVICESTATETYPE$\\tGRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$\\tGRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$\nservice_perfdata_file_mode=a\nservice_perfdata_file_processing_interval=15\nservice_perfdata_file_processing_command=omd-process-service-perfdata-file\n\n#\n# host performance data\n#\nhost_perfdata_file=/omd/sites/SITENAME/var/pnp4nagios/host-perfdata\nhost_perfdata_file_template=DATATYPE::HOSTPERFDATA\\tTIMET::$TIMET$\\tHOSTNAME::$HOSTNAME$\\tHOSTPERFDATA::$HOSTPERFDATA$\\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\\tHOSTSTATE::$HOSTSTATE$\\tHOSTSTATETYPE::$HOSTSTATETYPE$\\tGRAPHITEPREFIX::$_HOSTGRAPHITEPREFIX$\\tGRAPHITEPOSTFIX::$_HOSTGRAPHITEPOSTFIX$\nhost_perfdata_file_mode=a\nhost_perfdata_file_processing_interval=15\nhost_perfdata_file_processing_command=omd-process-host-perfdata-file\n\u003c/pre\u003e\n\n(3) Update etc/nagios/conf.d/pnp4nagios.cfg (remember to replace SITENAME).\n\n\u003cpre\u003e\ndefine command{\n       command_name    omd-process-service-perfdata-file\n       command_line    /bin/mv /omd/sites/SITENAME/var/pnp4nagios/service-perfdata /omd/sites/SITENAME/var/pnp4nagios/spool/service-perfdata.$TIMET$ \u0026\u0026 cp /omd/sites/SITENAME/var/pnp4nagios/spool/service-perfdata.$TIMET$ /omd/sites/SITENAME/var/graphios/spool/\n}\n\ndefine command{\n       command_name    omd-process-host-perfdata-file\n       command_line    /bin/mv /omd/sites/SITENAME/var/pnp4nagios/host-perfdata /omd/sites/SITENAME/var/pnp4nagios/spool/host-perfdata.$TIMET$ \u0026\u0026 cp /omd/sites/SITENAME/var/pnp4nagios/spool/host-perfdata.$TIMET$ /omd/sites/SITENAME/var/graphios/spool/\n}\n\u003c/pre\u003e\n\n(4) Optional: If you don't want PNP4NAGIOS to ever see perfdata for checks that Graphios is exporting data for, you can modify the ~/etc/nagios/conf.d/pnp4nagios.cfg command lines to remove data with a grep. In the below case, we grep out a specific string (GRAPHITEPREFIX\\:\\:lustre) to remove perfdata containing that string. This involves a little move moving around of files, but nothing excessive and stops PNP4NAGIOS from trying to genearte RRD files with that data. (Again remember to change SITENAME).\n\n\u003cpre\u003e\ndefine command{\n       command_name    omd-process-service-perfdata-file\n       #command_line    /bin/mv /omd/sites/SITENAME/var/pnp4nagios/service-perfdata /omd/sites/SITENAME/var/pnp4nagios/spool/service-perfdata.$TIMET$\n###GRAPHITE SETTING### ADDED REDIRECTION TO REMOVE exportstats\n       command_line    /bin/mv /omd/sites/SITENAME/var/pnp4nagios/service-perfdata /omd/sites/SITENAME/var/pnp4nagios/service-perfdata.$TIMET$ \u0026\u0026 /bin/cp /omd/sites/SITENAME/var/pnp4nagios/service-perfdata.$TIMET$ /omd/sites/SITENAME/var/graphios/spool/ \u0026\u0026 grep -v GRAPHITEPREFIX\\:\\:lustre /omd/sites/SITENAME/var/pnp4nagios/service-perfdata.$TIMET$ \u003e /omd/sites/SITENAME/var/pnp4nagios/spool/service-perfdata.$TIMET$ \u0026\u0026 /bin/rm /omd/sites/SITENAME/var/pnp4nagios/service-perfdata.*\n\n}\n\ndefine command{\n       command_name    omd-process-host-perfdata-file\n       #command_line    /bin/mv /omd/sites/SITENAME/var/pnp4nagios/host-perfdata /omd/sites/SITENAME/var/pnp4nagios/spool/host-perfdata.$TIMET$\n####GRAPHITE SETTING### ADDED REDIRECTION TO REMOVE exportstats\n       command_line    /bin/mv /omd/sites/SITENAME/var/pnp4nagios/host-perfdata /omd/sites/SITENAME/var/pnp4nagios/host-perfdata.$TIMET$ \u0026\u0026 /bin/cp /omd/sites/SITENAME/var/pnp4nagios/host-perfdata.$TIMET$ /omd/sites/SITENAME/var/graphios/spool/ \u0026\u0026 grep -v GRAPHITEPREFIX\\:\\:lustre /omd/sites/SITENAME/var/pnp4nagios/host-perfdata.$TIMET$ \u003e /omd/sites/SITENAME/var/pnp4nagios/spool/host-perfdata.$TIMET$ \u0026\u0026 /bin/rm /omd/sites/SITENAME/var/pnp4nagios/host-perfdata.*\n\u003c/pre\u003e\n\n# Check_MK Notes:\n\nHow to set custom variables for services and hosts using check_mk config files. (For OMD please don't overlook the notes above).\n\n(1) For host perf data just create a new file named \"extra_host_conf.mk\" inside your check_mk conf.d dir.\n\n\u003cpre\u003e\nextra_host_conf[\"_graphiteprefix\"] = [\n  ( \"DESIREDPREFIX.ping\", ALL_HOSTS),\n]\n\u003c/pre\u003e\n\n(2) Run check_mk -O to updated and reload Nagios.\n\n(3) Test via \"check_mk -N hostname | less\", to see if your prefix or postfix is there.\n\nFor service perf data create a file called, \"extra_service_conf.mk\". Remember you can use your host tags or any of kinds of tricks with check_mk config files.\n\n\u003cpre\u003e\nextra_service_conf[\"_graphiteprefix\"] = [\n  ( \"DESIREDPREFIX.check_mk\", ALL_HOSTS, [\"Check_MK\"]),\n  ( \"DESIREDPREFIX.cpu.load\", ALL_HOSTS, [\"CPU load\"]),\n]\n\u003c/pre\u003e\n\n- - -\n__Tip__: An easy way to produce graphite keys in the format: `$company.$server.$metric` is:\n\n(1) Set `metric_base_path` to $company in `graphios.cfg`.\n\n(2) In your 'extra' check_mk config files set your graphiteprefix to $metric, and set no graphiteprefix.\n\n\u003cpre\u003e\nextra_host_conf[\"_graphitepostfix\"] = [\n  # e.g. mycompany.server123.ping\n  ( \"ping\", ALL_HOSTS),\n]\n\nextra_service_conf[\"_graphitepostfix\"] = [\n  # e.g. mycompany.server123.cpu.load\n  ( \"cpu.load\", ALL_HOSTS, [\"CPU load\"]),\n]\n\u003c/pre\u003e\n\n\n# Trouble getting it working?\n\nMany people are running graphios now (cool!), but if you are having trouble\ngetting it working let me know. I am not offering to teach you how to setup\nNagios, this is for intermediate+ nagios users. Email me at\nshawn@systemtemplar.org and I will do what I can to help.\n\n# Got it working?\n\nCool! Drop me a line and let me know how it goes.\n\n# Find a bug?\n\nOpen an Issue on github and I will try to fix it asap.\n\n# Contributing\n\nI'm open to any feedback / patches / suggestions.\n\n# Special Thanks\n\nSpecial thanks to Dave Josephsen who added the multiple backend support and\nworked with me to design and build the new version of graphios.\n\nShawn Sterling shawn@systemtemplar.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawn-sterling%2Fgraphios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshawn-sterling%2Fgraphios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawn-sterling%2Fgraphios/lists"}