<commit_before><?php
// RRDtool datasource plugin.
//     gauge:filename.rrd:ds_in:ds_out
//     filename.rrd:ds_in:ds_out
//     filename.rrd:ds_in:ds_out
//

//include_once dirname(__FILE__) . "/../Utility.phpace Weathermap\Plugins\Datasources;
namespace Weathermap\Plugins\Datasources;

use Weathermap\Core\MapUtility;
use Weathermap\Core\Map;

/**
 * Get data from rrdtool files (also aggregate data, and also from Cacti's rrd poller cache)
 *
 * @package Weathermap\Plugins\Datasources
 */
class RRDTool extends Base
{
    private $localDataIDsSeen;

    private $rrdUsePollerOutput = false;

    public function __construct()
    {
        parent::__construct();

        $this->localDataIDsSeen = array();

        $this->regexpsHandled = array(
            '/^(.*\.rrd):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/',
            '/^(.*\.rrd)$/'
        );
        $this->name = "RRD";
    }


    /**
     * @param Map $map
     * @return bool
     */
    public function init(&$map)
    {
        global $config;

        if ($map->context == 'cacti') {
            MapUtility::debug("RRD DS: path_rra is " . $config["rra_path"] . " - your rrd pathname must be exactly this to use poller_output\n");
            // save away a couple of useful global SET variables
            $map->addHint("cacti_path_rra", $config["rra_path"]);
            $map->addHint("cacti_url", $config['url_path']);
        }

        $usePollerOutput = intval($map->getHint('rrd_use_poller_output'));

        # Are we in Cacti?
        if ($usePollerOutput && $map->context != 'cacti') {
            MapUtility::debug("Can't use poller_output from command-line - disabling rrd_use_poller_output [WMRRD99]\n");
            $this->rrdUsePollerOutput = false;
        }

        if (file_exists($map->rrdtool)) {
            if ((function_exists('is_executable')) && (!is_executable($map->rrdtool))) {
                MapUtility::warn("RRD DS: RRDTool exists but is not executable? [WMRRD01]\n");<commit_msg>Nothing ever set $this->usePollerOutput to true.<commit_after><?php
// RRDtool datasource plugin.
//     gauge:filename.rrd:ds_in:ds_out
//     filename.rrd:ds_in:ds_out
//     filename.rrd:ds_in:ds_out
//

//include_once dirname(__FILE__) . "/../Utility.phpace Weathermap\Plugins\Datasources;
namespace Weathermap\Plugins\Datasources;

use Weathermap\Core\MapUtility;
use Weathermap\Core\Map;

/**
 * Get data from rrdtool files (also aggregate data, and also from Cacti's rrd poller cache)
 *
 * @package Weathermap\Plugins\Datasources
 */
class RRDTool extends Base
{
    private $localDataIDsSeen;

    private $rrdUsePollerOutput = false;

    public function __construct()
    {
        parent::__construct();

        $this->localDataIDsSeen = array();

        $this->regexpsHandled = array(
            '/^(.*\.rrd):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/',
            '/^(.*\.rrd)$/'
        );
        $this->name = "RRD";
    }


    /**
     * @param Map $map
     * @return bool
     */
    public function init(&$map)
    {
        global $config;

        if ($map->context == 'cacti') {
            MapUtility::debug("RRD DS: path_rra is " . $config["rra_path"] . " - your rrd pathname must be exactly this to use poller_output\n");
            // save away a couple of useful global SET variables
            $map->addHint("cacti_path_rra", $config["rra_path"]);
            $map->addHint("cacti_url", $config['url_path']);
        }

        $this->usePollerOutput = intval($map->getHint('rrd_use_poller_output'));

        # Are we in Cacti?
        if ($this->usePollerOutput && $map->context != 'cacti') {
            MapUtility::debug("Can't use poller_output from command-line - disabling rrd_use_poller_output [WMRRD99]\n");
            $this->rrdUsePollerOutput = false;
        }

        if (file_exists($map->rrdtool)) {
            if ((function_exists('is_executable')) && (!is_executable($map->rrdtool))) {
                MapUtility::warn("RRD DS: RRDTool exists but is not executable? [WMRRD01]\n");
{'fraction_non_alphanumeric': 0.15583768981827234, 'fraction_numerical': 0.003983071944236993, 'mean_word_length': 2.59391771019678, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1076620', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1337, 'n_words': 264}