Setting up Graphios when using OMD/Check_MK
The Graphios instructions provided by the author are accurate, but for those who need some hand-holding (like me), here's the actual process (on CentOS 6.5, OMD 1.20). If you need help, comment and I'll see what I can do. I'm new to this, too.
I am using the "use_service_desc = True" because it works and we're new to this. I am assuming we'll change this going forward...
- Install pre-reqs
- Tried using pip, but still had issues with post-setup, so I just cloned from github
- Install Graphios
- cd into your cloned repo
- python setup.py install
- Edit the config file
- edit /etc/graphios/graphios.cfg
- See below because blogger just isn't great for code blocks...
- Configure service
- I didn't have much luck with the post-setup, so I did this:
- edit /etc/init.d/graphios
- Paste in the contents of: https://github.com/shawn-sterling/graphios/blob/master/init/rhel/graphios
- Change GRAPHIOS_USER to match your OMD sitename user
- I changed the log file to: /var/log/graphios.log
- Then changed permissions/owner on that file to OMD sitename user
- Probably will need to set up log rotation?...
- Create spool dir
- /omd/sites/SITENAME/var/graphios/spool/
- If you did this as root, chown -R SITENAME:SITENAME the graphios dir
- This dir is specified in the pnp4nagios.cfg (as per Graphios readme) that gets edited later on in this walkthrough
- Re-do symlink:
- cd /omd/sites/cama/etc/nagios/nagios.d (or cd ~/etc/nagios/nagios.d if doing as SITENAME user)
- ls -al (you should see the symlink: pnp4nagios.cfg -> ../../pnp4nagios/nagios_npcdmod.cfg
- rm ~/etc/nagios/nagios.d/pnp4nagios.cfg
- ln -s ../../pnp4nagios/nagios_npcd.cfg pnp4nagios.cfg
- ls -al (now should be: pnp4nagios.cfg -> ../../pnp4nagios/nagios_npcd.cfg )
- Modify ~/etc/pnp4nagios/nagios_npcd.cfg as per Graphios readme
- Just tacking on the Graphios bits to the end of hostname/service template definitions
- Modify pnp4nagios.cfg config as per Graphios readme
- Did you change the sitename? Everywhere? (like 6 times? the readme instructions have SITENAME and prod...where your SITENAME should go)
- If you copy-pasta'd the command definitions in, did you change the sitename AND comment out the original commands?
- Start the service and tail the log
- service graphios start
- tail -f /var/log/graphios.log
- You should see metrics start getting processed...
Tail of the graphios log...
December 30 09:23:22 graphios.py INFO Processed 2 files (0 metrics) in /omd/sites/SITENAME/var/graphios/spool//etc/graphios/graphios.cfg - relevant settings
December 30 09:23:37 graphios.py INFO Processed 2 files (86 metrics) in /omd/sites/SITENAME/var/graphios/spool/
# graphios log info
log_file = /var/log/graphios.log
debug = False
# use service description, most people will NOT want this, read documentation!
use_service_desc = True
enable_carbon = True
carbon_servers = graphite.domain.com:2004
I am using the "use_service_desc = True" because it works and we're new to this. I am assuming we'll change this going forward...
Hi Chris ,
ReplyDeleteGreat howto but I,m getting following error when is send metrics to carbon :
There is no three field.
I think is something about my perfdata format template, can you post here one line of your perfdata file to compare with mine.
Thank u in advance.
I got this from (OMD site path)/tmp/nagios/status.dat, it's one of the services we were initially having trouble with using graphios.
Deleteperformance_data='Metric'=3716;-1;;; [cscript.exe]
Is that what you're looking for?
I mean like what the perfdata file like ( /omd/sites/***/var/graphios/spool/service-perfdata.1434645464) , mine is look like this:
ReplyDeleteDATATYPE::SERVICEPERFDATA TIMET::1434645451 HOSTNAME::dwdwda SERVICEDESC::Check_MK SERVICEPERFDATA::execution_time=1.000 user_time=0.140 system_time=0.040 children_user_time=0.000 children_system_time=0.000 SERVICECHECKCOMMAND::check-mk HOSTSTATE::UP HOSTSTATETYPE::HARD SERVICESTATE::OK SERVICESTATETYPE::HARD GRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$ GRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$
With that content I get errors from carbon log like "[graphite] 2015/06/16 17:05:28 unable to parse data: which doesn't have three fields"
Sorry, see below. Also, check out this github issue for graphios, might shed some light: https://github.com/shawn-sterling/graphios/issues/54
DeleteDATATYPE::SERVICEPERFDATA TIMET::1434724520 HOSTNAME::camasves05 SERVICEDESC::Check_MK SERVICEPERFDATA::execution_time=0.397 user_time=0.040 system_time=0.020 children_user_time=0.000 children_system_time=0.000 SERVICECHECKCOMMAND::check-mk HOSTSTATE::UP HOSTSTATETYPE::HARD SERVICESTATE::OK SERVICESTATETYPE::HARD::HARD GRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$ GRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$
This is just a random one I pulled.
Hello,
ReplyDeleteThanks for writing up this walk through. After following your walk through and Shaw's Readme on GitHub, I am having issues with graphios still. This is what I get when I tail the logs:
August 04 09:29:17 graphios.py DEBUG Processing spool directory /omd/sites/SITENAME/var/graphios/spool
August 04 09:29:17 graphios.py INFO Processed 0 files (0 metrics) in /omd/sites/SITENAME/var/graphios/spool
August 04 09:29:17 graphios.py DEBUG graphios sleeping.
This log repeats about 3-4 times a minute. These are the only entries in the logs.
Once I flip the symlink from nagios_npcdmod.cfg to nagios_npcd.cfg, all my PNP graphs break as well. If I flip it back to nagios_npcdmod.cfg, PNP graphs work again.
If helpful, here are my graphios.cfg, nagios_npcd.cfg and pnp4nagios.cfg: https://gist.github.com/jasonhurlbert/bed8b4e77fa7afe3d5e4
If you have any insight about what's going on, I'd really appreciate it!
Thank you,
-Jason
Jason, I think that first part means you've not set your spool dir properly. So Graphios is working, but no metrics are being dumped into the spool dir. The 3-4 times a minute makes sense with your interval being 15 (4x/minute).
DeleteMy nagios_npcd.cfg file is different from yours (did a quick WinDiff). Here's what my running config has:
#
# PNP4Nagios Bulk Mode with npcd
#
process_performance_data=1
#
# service performance data
#
service_perfdata_file=/omd/sites/cama/var/pnp4nagios/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$::$SERVICESTATETYPE$\tGRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$\tGRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=omd-process-service-perfdata-file
#
# host performance data
#
host_perfdata_file=/omd/sites/cama/var/pnp4nagios/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$::$HOSTSTATETYPE$\tGRAPHITEPREFIX::$_HOSTGRAPHITEPREFIX$\tGRAPHITEPOSTFIX::$_HOSTGRAPHITEPOSTFIX$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=omd-process-host-perfdata-file
Compare the two, you should see the differences - maybe that'll do the trick?
Yep, it was a bad copy/paste job, maybe it wrapped or something. Either way, thanks for the proofread!
DeleteYeah, I had issues with that at first, too - mainly because I had no grasp on what those fields were doing and was a total noob. Glad you got it working!
DeleteHello
ReplyDeleteI have a problem with this setup maybe you can give me a help!
I have followed all this and after a lot of hours pulling my hair out i managed to have things working, well, sort of.
My setup is omd 1.30 and all is built in check_mk.
I have graphite working and graphios; my spool dir is full of files, but i dont see graphios using them.
If i run the command manually as for graphite install instructions i see the metris with correct names, but else not sure what is going on.
Hey Frederico - unfortunately I've moved on from the company where this was set up, so I can't be of much help. If you are seeing the files get populated that's a good sign - perhaps it's as simple as the dir graphios is looking in is incorrect? Or maybe graphios doesn't have permissions to read?
DeleteThanks for your reply.
ReplyDeleteStill not able to understand what is going on here...
In grafana i see the entries fo rcheck_mk process metrics, pings to all hosts but nothing else...
I^m not sure whats going on here.
Maybe post your question on the Github repo for graphios?
Delete