Observium, Unix-Agent and SMART attributes

Leave a Reply

Comment as a guest.

 
  1. I’m looking at this now. The patch gives me this output:

    [code]/opt/observium # patch -p0 $text)
    {
    – $graph_type = $key;
    – $graph_array[‘to’] = $config[‘time’][‘now’];
    – $graph_array[‘id’] = $app[‘app_id’];
    – $graph_array[‘type’] = “application_”.$key;
    + list($type, $subtype) = explode(‘!’, $key);
    + $graph_type = $key;
    + $graph_array[‘to’] = $config[‘time’][‘now’];
    + $graph_array[‘id’] = $app[‘app_id’];
    + $graph_array[‘type’] = ‘application_’ . $type;
    + if (!empty($subtype)) {
    + $graph_array[‘subtype’] = $subtype;
    + }
    echo ”;
    echo ”,$text,”;[/code]

    apps.inc.php.rej contains:
    [code]— html/pages/device/apps.inc.php (revision 5240)
    +++ html/pages/device/apps.inc.php (working copy)
    @@ -133,10 +133,14 @@

    foreach ($app_graphs[$vars[‘app_section’]] as $key => $text)
    {
    – $graph_type = $key;
    – $graph_array[‘to’] = $config[‘time’][‘now’];
    – $graph_array[‘id’] = $app[‘app_id’];
    – $graph_array[‘type’] = “application_”.$key;
    + list($type, $subtype) = explode(‘!’, $key);
    + $graph_type = $key;
    + $graph_array[‘to’] = $config[‘time’][‘now’];
    + $graph_array[‘id’] = $app[‘app_id’];
    + $graph_array[‘type’] = ‘application_’ . $type;
    + if (!empty($subtype)) {
    + $graph_array[‘subtype’] = $subtype;
    + }
    echo ”;
    echo ”,$text,”;[/code]

    I’m not sure what to make of this?

    1. So, save the downloadded file to observium-smart-0.1.patch in the Observium root directory, then enter the following command to apply the patch,

      patch -p0 < observium-smart-0.1.patch This should normally generate something like, patching file html/pages/device/apps/smart.inc.php patching file html/pages/device/apps.inc.php etc..

      1. Apologies, copy/paste above failed but I couldn’t edit my message.

        When running the patch (as root), I get:
        # patch -p0 < observium-smart-0.1.patch
        patching file html/pages/device/apps/smart.inc.php
        patching file html/pages/device/apps.inc.php
        Hunk #1 FAILED at 133.
        1 out of 1 hunk FAILED -- saving rejects to file html/pages/device/apps.inc.php.rej
        patching file html/includes/graphs/application/smart.inc.php
        patching file includes/polling/applications/smart.inc.php

        The contents of the apps.inc.rej:

        --- html/pages/device/apps.inc.php (revision 5240)
        +++ html/pages/device/apps.inc.php (working copy)
        @@ -133,10 +133,14 @@

        foreach ($app_graphs[$vars['app_section']] as $key => $text)
        {
        - $graph_type = $key;
        - $graph_array['to'] = $config['time']['now'];
        - $graph_array['id'] = $app['app_id'];
        - $graph_array['type'] = "application_".$key;
        + list($type, $subtype) = explode('!', $key);
        + $graph_type = $key;
        + $graph_array['to'] = $config['time']['now'];
        + $graph_array['id'] = $app['app_id'];
        + $graph_array['type'] = 'application_' . $type;
        + if (!empty($subtype)) {
        + $graph_array['subtype'] = $subtype;
        + }
        echo '';
        echo '',$text,'';

  2. Yeah, this requires the latest version of Observium, including the license/subscription.

    In html/pages/device/apps.inc.php, find line (134)

    and it should look like,

        foreach ($app_graphs[$vars['app_section']] as $key => $text)
        {
          list($type, $subtype) = explode('!', $key);
          $graph_type             = $key;
          $graph_array['to']      = $config['time']['now'];
          $graph_array['id']      = $app['app_id'];
          $graph_array['type']    = 'application_' . $type;
          if (!empty($subtype)) {
              $graph_array['subtype'] = $subtype;
          }
    

    Else, just put this file online somewhere, and i’ll update it.

  3. Note:
    this line contains a typo:
    /etc/xinet.d/observium_agent_xinetd

    should read:
    /etc/xinetd.d/observium_agent_xinetd

    I upgraded to the latest community version, the patch ran fine. I get ‘Smart’ under ‘Apps’, so I suppose this part is working.

    Selecting it gives me the host (localhost) and under that, no graphs.

    You mention the file ‘smart’ needs to go under /usr/lib/observium_agent/plugins, but the ones I had (mysql, apache) are under /usr/lib/observium_agent/local. I initially placed it under local with the other scripts, but now I have also created the plugins folder and copied it there.

    I edited the file to initially do 1 harddisk:
    my @smartdevices = (‘-d ata ‘/dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S’);
    my @smartids = (1, 7, 195);

    and left the ID’s alone for now.

    Any ideas how I can troubleshoot this?

    I really appreciate your help with this, thanks a lot so far!

    1. Thanks for the typo mention, has been fixed.

      my @smartdevices = (‘-d ata ‘/dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S’);

      That’s not correct, you have an additional ‘

      Correct line:

      my @smartdevices = (‘-d ata /dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S’);

      Running this script should not generate any errors, just some lines with the stats.

      So, do a ‘perl smart’ with your current version, and it’ll normally report a syntax error.

      Removing the extra ‘ should fix the issue.

  4. should the file be in /usr/lib/observium_agent/local or in plugins as you suggest?

    I edited both to be sure :), running it with perl outputs:
    <<>>
    /dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S

    but no stats.

    When I remove the “-d ata” part, it outputs:
    <<>>
    /dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S
    1:100
    7:100

    Is that the correct output?

    1. Need to check that, but use plugins just to be sure.

      The last result is the correct one,

      < <>>
      /dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S
      1:100
      7:100

      you should be able to run smartctl with the arguments listed,

      smartctl -a -d ata /dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S

      I’m guessing the above command generates an error with smart in your case, and thus, you get no stats.

      smartctl -a /dev/disk/by-id/ata-Hitachi_HUS724040ALE640_PK1331PAG80D8S

      will print the ‘normal’ SMART output.

  5. One other thing I should mention is that the ‘Smart’ option in menu didn’t appear automatically, I ticked the ‘smart’ option under device properties (with he warning on top to not do this manually .. but since it didn’t appear otherwise I did it anyway).

    Anything else I can try to see where its going wrong?

    ps. without the -d ata the smartctl command outputs as you said it would.

    1. Pablo, still no data ?

      If running the perl script returns the correct output (smart id + ‘:’ + value), try to run the Observium poller.php -h <hostname>

      and see if that returns errors.

      Check the RRD file (observium_root/rrd/hostname/smart-*) via

      rrdtool dump

      Normally this file should contain all the results it received from the unix-agent / perl script.

    2. Be sure you enabled Unix Agent in the device settings’ ‘Modules’ tab.

      Also, try to install RRD for PHP, via

      pecl install rrd

      This will provide better results.

  6. Hi Geek,

    I have problems trying to install smart monitoring and display in Observium. I am using ubuntu 14.04 LTS on all of my servers.

    The “agent” part is fairly easy and both plugin works and when I telnet to agent’s port there is smart data.

    However, when I do poller.php -h all it says “No include: smart”, then displays smart among some other names, but there’s no RRD file in rrd directory and obviously no data in Observium.

    Do you have any ideas? The patch applied without errors. Latest observium version CE 0.14.4.5229

    1. Can you check the device settings, and ‘Applications’ tab. Does it mention SMART ?

      You would need to enable it, since the code uses a mix of the old & new system. Still need time to streamline it more into the new system.

  7. I open the device by clicking on server name. Then I click the settings icon, and go to Modules. Unix agent is enabled both system wide and on this server. Then I click Applications and Smart is ON. Also on Observium top menu I have Apps menu, and there is Smart option. It shows two of my servers but no data at all. Just server names. As if there was no data. Also the RRD file is not existent. So perhaps poller is either ignoring the received data or loses it while it tries to write it. I dont know how to further debug and smart attributes are the only thing missing in Observium for me. I followed your guide on both servers and both are reporting smart data by the agent and observium is not collecting / using the data.

    1. I feel like I’m closing to success. I edited the ./includes/polling/unix-agent.inc.php file and between lines

      if ($section== “nginx”) { $sa = “app”; $sb = “nginx”; }

      and

      # FIXME why is this here? New application scripts should just return app-$foo
      if ($section == “freeradius”) { $sa = “app”; $sb = “freeradius”; }

      I have added the line

      if ($section == “smart”) { $sa = “app”; $sb = “smart”; }

      So now I have files smart-sda.rrd and smart-sdb.rrd but I suppose they are gibberish, because the graphs are still not showing. The files are created though, I just dont know what data they contain: rrdinfo dump shows only “NaN”, so… I think I’ll just give up. I lack the skills.

      1. Let me just say that the RRD file looks like it’s having the correct data, judging from part of the dump that I just did on RRD file:

        7
        GAUGE
        600
        0.0000000000e+00
        1.2500000000e+11


        100
        4.1556630000e+02
        0

        Looks like smart arrtibute 7, value 100. Just don’t know why no graphs… as if they looked for wrong file? Could you point me to the file that is responsible for generating smart graphs? And perhaps displaying raw values in Observium?

        1. The graphs showed after I have the beforementioned change to observium file. It’s not under Apps -> Smart, but under each device’s Smart tab.

Read Next

Sliding Sidebar