Metainformationen zur Seite

Stats4Lox::telegrafinternals

my ($response) = telegrafinternals();


Creates a hash with internal telegraf statistics. The statistics will be created by telegraf every 10s. This function just gathers these statistics and put them into a hash.  

Parameter

This function do not need any parameters.

Return value

ParameterDescription
1. returnHash with statistic data.


Detailed description of each returned value can be found in the telegraf documentation: https://github.com/influxdata/telegraf/blob/master/plugins/inputs/internal/README.md

The returned hash looks like this: 

$VAR1 = \{
            'memstats' => {
                            'heap_objects' => '14954',
                            'mallocs' => '5113349',
                            'alloc_bytes' => '7478688',
                            'total_alloc_bytes' => '1598334576',
                            'heap_released_bytes' => '5275648',
                            'heap_idle_bytes' => '10895360',
                            'pointer_lookups' => '0',
                            'num_gc' => '914',
                            'heap_in_use_bytes' => '9224192',
                            'frees' => '5098395',
                            'timestamp' => '1619255940000000000',
                            'heap_alloc_bytes' => '7478688',
                            'heap_sys_bytes' => '20119552',
                            'sys_bytes' => '20119552'
                          },
            'process' => {
                           'errors' => '0',
                           'timestamp' => '1619255940000000000'
                         },
            'write' => {
                         'influxdb' => {
                                         'metrics_filtered' => '0',
                                         'metrics_added' => '51390',
                                         'metrics_dropped' => '0',
                                         'buffer_limit' => '100000',
                                         'write_time_ns' => '14375885',
                                         'timestamp' => '1619255940000000000',
                                         'errors' => '0',
                                         'buffer_size' => '0',
                                         'metrics_written' => '51390'
                                       },
                         'file' => {
                                     'metrics_filtered' => '390',
                                     'metrics_dropped' => '0',
                                     'metrics_added' => '51000',
                                     'buffer_limit' => '100000',
                                     'write_time_ns' => '777968',
                                     'timestamp' => '1619255940000000000',
                                     'metrics_written' => '51000',
                                     'buffer_size' => '0',
                                     'errors' => '0'
                                   }
                       },
            'agent' => {
                         'metrics_dropped' => '0',
                         'gather_errors' => '51391',
                         'metrics_written' => '102390',
                         'metrics_gathered' => '51391',
                         'timestamp' => '1619255940000000000'
                       },
            'gather' => {
                          'http' => {
                                      'metrics_gathered' => '390',
                                      'timestamp' => '1619255940000000000',
                                      'errors' => '206',
                                      'gather_time_ns' => '9740'
                                    },
                          'internal' => {
                                          'metrics_gathered' => '51001',
                                          'timestamp' => '1619255940000000000',
                                          'errors' => '0',
                                          'gather_time_ns' => '1139167'
                                        },
                          'socket_listener' => {
                                                 'metrics_gathered' => '0',
                                                 'timestamp' => '1619255940000000000',
                                                 'errors' => '0',
                                                 'gather_time_ns' => '1666'
                                               }
                        }
          };


Usage

#!/usr/bin/perl
 
use LoxBerry::System;
use Data::Dumper;
 
require "$lbpbindir/libs/Stats4Lox.pm";
 
# Debug
$Stats4Lox::DEBUG = 0;
$Stats4Lox::DUMP = 0;
 
my ($resp) = Stats4Lox::telegrafinternals();
 
print Dumper (\$resp);