Giter VIP home page Giter VIP logo

datadog-smartmon's Introduction

datadog-smartmon

Datadog plugin to report hard drive metrics

Introduction

A simple Datadog plugin to report hard drive stats. Uses pySMART to discover all hard drives and pushes all S.M.A.R.T information for each drive to DataDog. Useful for monitoring a file server or home nas.

Alt text

Instructions

  • Install smartmon tools
apt-get install smartmontools
  • Allow smartctl to be executed by non-root users (sorry!)
chmod +s /usr/sbin/smartctl
  • Install pySMART to the custom datadog embedded python location (seriously?!)
sudo -Hu dd-agent /opt/datadog-agent/embedded/bin/pip install pysmart
  • Copy over the custom check and check config file to the DataDog agent install directory
cp smartmon.yaml /etc/datadog-agent/conf.d/
cp smartmon.py /etc/datadog-agent/checks.d/
  • Restart the Datadog agent

datadog-smartmon's People

Contributors

ajclark avatar delfer avatar imajes avatar irabinovitch avatar juniorh avatar rahulpowar avatar sashacmc avatar shigeya-dd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

datadog-smartmon's Issues

Not compatible with datadog-agent V6

PDT | ERROR | (autoconfig.go:248 in getChecksFromConfigs) | Unable to load the check: unable to load any check from config 'smartmon'

sudo -u dd-agent -- datadog-agent check smartmon

Error: could not load smartmon:
* Core Check Loader: Check smartmon not found in Catalog
* JMX Check Loader: check is not a jmx check, or unable to determine if it's so
* Python Check Loader: ['Traceback (most recent call last):\n', '  File "/etc/datadog-agent/checks.d/smartmon.py", line 1, in <module>\n    from pySMART import DeviceList\n', '  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/pySMART/__init__.py", line 108, in <module>\n    from .device import Device, smart_health_assement\n', '  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/pySMART/device.py", line 768\n', '    *self.smart_options,\n', '    ^\n', 'SyntaxError: invalid syntax\n']
Error: no valid check found
Usage:
  agent check <check_name> [flags]

support devices behind megaraid controllers

when using smartctl, you need to pass in -d megaraid,x to indicate the drive to collect, so say you have two drives, you would do something like

smartctl -A /dev/sda -d megaraid,0
smartctl -A /dev/sda -d megaraid,1

can this be updated to support arrays?

Metric has non float value

Hi Allan,

Thanks for this project, i got some issue when execute "sudo -u dd-agent -- datadog-agent check smartmon" :

Collector

Running Checks

`
smartmon (unversioned)
----------------------
  Instance ID: smartmon:d884b5186b651429 [WARNING]
  Total Runs: 1
  Metric Samples: Last Run: 13, Total: 13
  Events: Last Run: 0, Total: 0
  Service Checks: Last Run: 0, Total: 0
  Average Execution Time : 697ms

  Warning: Metric: &#39;smartmon.Reallocated_Sector_Ct&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Power_On_Hours&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Reallocated_Sector_Ct&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Power_On_Hours&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Reallocated_Sector_Ct&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Power_On_Hours&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Reallocated_Sector_Ct&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Power_On_Hours&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Reallocated_Sector_Ct&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.
    
  Warning: Metric: &#39;smartmon.Power_On_Hours&#39; has non float value: &#39;-&#39;. Only float values can be submitted as metrics.

Check has run only once, if some metrics are missing you can try again with --check-rate to see any other metric if available.

Can you check it?

Regards,

Smartpy not collect metric

I have a centos 8 and v7.29.1 version of the datadog agent. I've done all the mentioned settings, but it seems that the script doesn't collect any metrics. The output of the datadog agent status follows:

smartmon (unversioned)
----------------------
Instance ID: smartmon:d884b5186b651429 [OK]
Configuration Source: file:/etc/datadog-agent/conf.d/smartmon.yaml
Total Runs: 85
Metric Samples: Last Run: 0, Total: 0
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time: 19ms
Last Execution Date : 2021-07-21 14:09:40 UTC (1626876580000)
Last Successful Execution Date : 2021-07-21 14:09:40 UTC (1626876580000)

Got this error

Feb 12 03:21:19 nasbox dd.collector[19579]: ERROR (init.py:812): Check 'smartmon' instance #0 failed#012Traceback (most recent call last):#1
2 File "/opt/datadog-agent/agent/checks/init.py", line 795, in run#012 self.check(copy.deepcopy(instance))#12 File "/etc/dd-agent/check
s.d/smartmon.py", line 12, in check#012 devlist = DeviceList()#12 File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/pySMART/devi
ce_list.py", line 51, in init#12 self._initialize()#12 File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/pySMART/device_lis
t.py", line 106, in initialize#012 self.devices.append(Device(name))#12 File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/pySMA
RT/device.py", line 140, in init#12 self.update()#12 File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/pySMART/device.py",
line 461, in update#012 ASCQ = line
[2][:-1]#012IndexError: list index out of range

Minor readme update

@ajclark plugin works great. You may just want to update the following so it matches the latest DataDog install paths?

CHANGE FROM:
Copy over the custom check and check config file to the DataDog agent install directory
cp smartmon.yaml /etc/dd-agent/conf.d/
cp smartmon.py /etc/dd-agent/checks.d/

CHANGE TO
Copy over the custom check and check config file to the DataDog agent install directory
cp smartmon.yaml /etc/datadog-agent/conf.d/
cp smartmon.py /etc/datadog-agent/checks.d/

Just a thought

Hass

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.