Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-1891

Asterisk Poller fails to form array correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • None
    • Professional Edition
    • Poller
    • None

    Description

      asterisk.inc.php has an ambiguous variable defined within, $data.

      As a result, when poller.php is ran against a machine with data returned from the unix-agent, the array is not formed correctly.

      Instead of:

      asterisk.Array
      (
      [activechan] => 0
      [activecall] => 0
      [iaxchannels] => 2
      [sipchannels] => 3
      [sippeers] => 6
      [sippeersonline] => 4
      [iaxpeers] => 0
      [iaxpeersonline] => 0
      )

      the string ".1activechan:0
      activecall:0
      iaxchannels:0
      sipchannels:9
      sippeers:34
      sippeersonline:18
      iaxpeers:1
      iaxpeersonline:1"

      Is returned.

      Renaming the $data variable to $asterisk_data and replacing all references in asterisk.inc.php resolved the issue.

      ~~~~
      /**

      • Observium
        *
      • This file is part of Observium.
        *
      • @package observium
      • @subpackage poller
      • @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
        *
        */

      if (!empty($agent_data['app']['asterisk']))
      {
      $app_id = discover_app($device, 'asterisk');
      foreach (explode("\n", $agent_data['app']['asterisk']) as $line)

      { list($key, $val) = explode(":", $line); $asterisk_data[$key] = intval($val); }

      rrdtool_update_ng($device, 'asterisk', $asterisk_data, $app_id);
      unset($key, $line, $val, $asterisk_data, $app_id);
      }

      // EOF
      ~~~~

      Attachments

        Activity

          People

            landy Mike Stupalov
            nanohost Damian McMillan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: