if ($db['partitioned']) {
            $partitioned = 'yes';
        } else {
            $partitioned = 'no';
        }
        $db_info .= $db['_id'] . ' : ' . 'partitioned = ' . $partitioned . ', primary = ' . $db['primary'] . ' || ';
    }
    write_to_data_lines($zabbix_name, "db_info", $db_info);
}
//-------------------------------------------------------------------------//
// Get data collection end time (we will use this to compute the total data collection time)
$end_time = time();
$data_collection_time = $end_time - $start_time;
write_to_data_lines($zabbix_name, "mongoDB_plugin_data_collection_time", $data_collection_time);
write_to_data_lines($zabbix_name, "mongoDB_plugin_version", $command_version);
write_to_data_lines($zabbix_name, "mongoDB_plugin_checksum", $md5_checksum_string);
// For DEBUG
if ($debug_mode) {
    $data_file_name = "/tmp/{$command_name}_{$file_base_name}.data";
    file_put_contents($data_file_name, implode("\n", $data_lines) . "\n");
}
$descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
$process = proc_open("zabbix_sender -vv -z {$zabbix_server} -p {$zabbix_server_port} -i - 2>&1", $descriptorspec, $pipes);
if (is_resource($process)) {
    fwrite($pipes[0], implode("\n", $data_lines));
    fclose($pipes[0]);
    while ($s = fgets($pipes[1], 1024)) {
        write_to_log("O: " . trim($s));
    }
    fclose($pipes[1]);
    while ($s = fgets($pipes[2], 1024)) {
        if ($db['partitioned']) {
            $partitioned = 'yes';
        } else {
            $partitioned = 'no';
        }
        $db_info .= $db['_id'] . ' : ' . 'partitioned = ' . $partitioned . ', primary = ' . $db['primary'] . ' || ';
    }
    write_to_data_lines($zabbix_name, "db_info", $db_info);
}
//-------------------------------------------------------------------------//
// Get data collection end time (we will use this to compute the total data collection time)
$end_time = time();
$data_collection_time = $end_time - $start_time;
write_to_data_lines($zabbix_name, "plugin.data_collection_time", $data_collection_time);
write_to_data_lines($zabbix_name, "plugin.version", $command_version);
write_to_data_lines($zabbix_name, "plugin.checksum", $md5_checksum_string);
// For DEBUG
if ($debug_mode) {
    $data_file_name = "/tmp/{$command_name}_{$file_base_name}.data";
    file_put_contents($data_file_name, implode("\n", $data_lines) . "\n");
}
$descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
$process = proc_open("zabbix_sender -vv -z {$zabbix_server} -p {$zabbix_server_port} -i - 2>&1", $descriptorspec, $pipes);
if (is_resource($process)) {
    fwrite($pipes[0], implode("\n", $data_lines));
    fclose($pipes[0]);
    while ($s = fgets($pipes[1], 1024)) {
        write_to_log("O: " . trim($s));
    }
    fclose($pipes[1]);
    while ($s = fgets($pipes[2], 1024)) {