Skip to main content

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.


  1. Install pre-reqs
    1. Tried using pip, but still had issues with post-setup, so I just cloned from github
  2. Install Graphios
    1. cd into your cloned repo
    2. python setup.py install
  3. Edit the config file
    1. edit /etc/graphios/graphios.cfg
    2. See below because blogger just isn't great for code blocks...
  4. Configure service
    1. I didn't have much luck with the post-setup, so I did this:
      1. edit /etc/init.d/graphios
      2. Paste in the contents of: https://github.com/shawn-sterling/graphios/blob/master/init/rhel/graphios
      3. Change GRAPHIOS_USER to match your OMD sitename user
      4. I changed the log file to: /var/log/graphios.log
      5. Then changed permissions/owner on that file to OMD sitename user
      6. Probably will need to set up log rotation?...
  5. Create spool dir
    1. /omd/sites/SITENAME/var/graphios/spool/
    2. If you did this as root, chown -R SITENAME:SITENAME the graphios dir
    3. This dir is specified in the pnp4nagios.cfg (as per Graphios readme) that gets edited later on in this walkthrough
  6. Re-do symlink:
    1. cd /omd/sites/cama/etc/nagios/nagios.d (or cd ~/etc/nagios/nagios.d if doing as SITENAME user)
    2. ls -al (you should see the symlink: pnp4nagios.cfg -> ../../pnp4nagios/nagios_npcdmod.cfg
    3. rm ~/etc/nagios/nagios.d/pnp4nagios.cfg
    4. ln -s ../../pnp4nagios/nagios_npcd.cfg pnp4nagios.cfg
    5. ls -al (now should be: pnp4nagios.cfg -> ../../pnp4nagios/nagios_npcd.cfg )
  7. Modify ~/etc/pnp4nagios/nagios_npcd.cfg as per Graphios readme
    1. Just tacking on the Graphios bits to the end of hostname/service template definitions
  8. Modify pnp4nagios.cfg config as per Graphios readme
    1. Did you change the sitename?  Everywhere? (like 6 times?  the readme instructions have SITENAME and prod...where your SITENAME should go)
    2. If you copy-pasta'd the command definitions in, did you change the sitename AND comment out the original commands?
  9. Start the service and tail the log
    1. service graphios start
    2. tail -f /var/log/graphios.log
    3. 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/
December 30 09:23:37 graphios.py INFO Processed 2 files (86 metrics) in /omd/sites/SITENAME/var/graphios/spool/
/etc/graphios/graphios.cfg - relevant settings
 # 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...

Comments

  1. Hi Chris ,

    Great 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.

    ReplyDelete
    Replies
    1. 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.

      performance_data='Metric'=3716;-1;;; [cscript.exe]

      Is that what you're looking for?

      Delete
  2. I mean like what the perfdata file like ( /omd/sites/***/var/graphios/spool/service-perfdata.1434645464) , mine is look like this:

    DATATYPE::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"

    ReplyDelete
    Replies
    1. Sorry, see below. Also, check out this github issue for graphios, might shed some light: https://github.com/shawn-sterling/graphios/issues/54

      DATATYPE::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.

      Delete
  3. Hello,

    Thanks 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

    ReplyDelete
    Replies
    1. 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).

      My 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?

      Delete
    2. Yep, it was a bad copy/paste job, maybe it wrapped or something. Either way, thanks for the proofread!

      Delete
    3. Yeah, 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!

      Delete
  4. Hello

    I 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.

    ReplyDelete
    Replies
    1. 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?

      Delete
  5. Thanks for your reply.
    Still 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.

    ReplyDelete
    Replies
    1. Maybe post your question on the Github repo for graphios?

      Delete

Post a Comment

Popular posts from this blog

DFSR - eventid 4312 - replication just won't work

This warning isn't documented that well on the googles, so here's some google fodder:


You are trying to set up replication for a DFS folder (no existing replication)Source server is 2008R2, 'branch office' server is 2012R2 (I'm moving all our infra to 2012R2)You have no issues getting replication configuredYou see the DFSR folders get created on the other end, but nothing stagesFinally you get EventID 4312:
The DFS Replication service failed to get folder information when walking the file system on a journal wrap or loss recovery due to repeated sharing violations encountered on a folder. The service cannot replicate the folder and files in that folder until the sharing violation is resolved.  Additional Information:  Folder: F:\Users$\user.name\Desktop\Random Folder Name\  Replicated Folder Root: F:\Users$  File ID: {00000000-0000-0000-0000-000000000000}-v0  Replicated Folder Name: Users  Replicated Folder ID: 33F0449D-5E67-4DA1-99AC-681B5BACC7E5  Replication Group…

Fixing duplicate SPNs (service principal name)

This is a pretty handy thing to know:

SPNs are used when a specific service/daemon uses Kerberos to authenticate against AD. They map a specific service, port, and object together with this convention: class/host:port/name

If you use a computer object to auth (such as local service):
MSSQLSVC/tor-sql-01.domain.local:1433

If you use a user object to auth (such as a service account, or admin account):
MSSQLSVC/username:1433

Why do we care about duplicate SPNs? If you have two entries trying to auth using the same Kerberos ticket (I think that's right...), they will conflict, and cause errors and service failures.

To check for duplicate SPNs:
The command "setspn.exe -X

C:\Windows\system32>setspn -X
Processing entry 7
MSSQLSvc/server1.company.local:1433 is registered on these accounts:
CN=SERVER1,OU=servers,OU=resources,DC=company,DC=local
CN=SQL Admin,OU=service accounts,OU=resources,DC=company,DC=local

found 1 groups of duplicate SPNs. (truncated/sanitized)

Note that y…

Logstash to Nagios - alerting based on Windows Event ID

This took way longer than it should have to get going...so here's a config and brain dump...

Why?
You want to have a central place to analyze Windows Event/IIS/local application logs, alert off specific events, alert off specific situations.  You don't have the budget for a boxed solution.  You want pretty graphs.  You don't particularly care about individual server states.  (see rationale below - although you certainly have all the tools here to care, I haven't provided that configuration)

How?
ELK stack, OMD, NXlog agent, and Rsyslog.  The premise here is as follows:

Event generated on server into EventLogNXlog ships to Logstash inputLogstash filter adds fields and tags to specified eventsLogstash output sends to a passive Nagios service via the Nagios NSCA outputThe passive service on Nagios (Check_MK c/o OMD) does its thing w. alerting
OMD
Open Monitoring Distribution, but the real point here is Check_MK (IIRC Icinga uses this...).  It makes Nagios easy to use and main…