Ad Widget

Collapse

DRBD Monitoring with Auto-Discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cpldave
    Junior Member
    • Oct 2013
    • 5

    #1

    DRBD Monitoring with Auto-Discovery

    Hi All,

    I thought I'd share my snippet for getting a simple DRBD monitoring solution up and running with LLD+Auto-Discovery Templates.

    I wrote this to monitor some older Ubuntu 10.04 machines running DRBD 8. Mileage may vary depending on your OS and the scripts available


    You'll need to get the following script:
    GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.


    and this is the template:
    GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.



    Also add the following to the servers being monitored (or append relevant files if they already exist):
    User Parameters:
    Code:
    UserParameter=drbd.resource.cstate[*],sudo /etc/zabbix/plugins/drbd_stats cstate $1
    UserParameter=drbd.resource.dstate[*],sudo /etc/zabbix/plugins/drbd_stats dstate $1
    UserParameter=drbd.resource.discovery,sudo /etc/zabbix/plugins/drbd_stats discovery
    /etc/sudoers.d/zabbix
    Code:
    zabbix ALL=(ALL) NOPASSWD:/etc/zabbix/plugins/drbd_stats
    This should add an "App - DRBD" template that can be assigned to hosts. It has two item prototypes for cstate/dstate and triggers for each. It will iterate over the output of "/etc/init.d/drbd status" during discovery and add entries for each resource it finds.

    It's not fool-proof, but it works for me. Happy to commit changes if anyone finds anything that could be fixed or made better.

    Hope that helps someone out.

    Cheers,
    DD
  • Paul Shore
    Junior Member
    • Jan 2014
    • 7

    #2
    Zabbix agentd isn't running the cstate or dstate commands

    Hi DD,

    Interested in using your script and template, so installed them on our Zabbix server and the hosts that I need to monitor DRBD on. As one of these is still in a testing state I then disconnected a DRBD resource expecting an alert, but nothing came.

    I looked into this and the drbd_stats command seams to be only run in the discovery manner - I turned debug to level 4 on the agentd.conf and it didn't show the cstate or dstate command being run. I also went into the Zabbix server and the values for cstate and dstate haven't been sent. So something is wrong - did you disconnect a DRBD resource and check you got an alert?

    Using Zabbix server 2.2.1 and agents connecting to a Debian server. I have manually run the drbd_stats command and it seams to be functioning fine and the r0 resource is found in Zabbix, but nothing for the cstate or dstate r0 entry.

    Any help would be appreciated.

    Thanks

    Paul

    Comment

    • cpldave
      Junior Member
      • Oct 2013
      • 5

      #3
      Hi Paul,

      Sorry it didn't work out for you. I haven't had any problems on my config as of yet, but we haven't put Zabbix into production and I've since trashed my DRBD dev setup which was used to create these checks.

      I will have to build another config and see how I go in testing. I can't give an ETA on when that will happen though, as a lot of other things going on at the moment.

      I will let you know what I find though.

      Cheers,
      DD

      Comment

      • Paul Shore
        Junior Member
        • Jan 2014
        • 7

        #4
        OK, looks like it is running cstate and dstate commands, but not getting to server

        OK. Turned on debug and ran for a while on the clients. Looking for cstate or dstate within the zabbix agentd log file indicate that they are being run.

        On the server, through we are not always getting the information.

        Monitoring -> Latest Data and then selecting the group + host. In the filters I am ticking the box to show items without data and show detail. I am getting the fields populated for cstate and dstate for my resource r0, but there is no latest data.

        I have clean down the templates and data and tried again - some times there is data, but the data is 40+ minutes old and the client is supposed to run every 5 minutes.

        Think I have some issues with my server so am going to turn on a bit more debug and see if I can see any errrors or issues, but I don't think there is anything wrong with your template or monitoring script.

        Thanks

        Paul

        Comment

        Working...