map configuration

  • Anonymous - 2012-08-24


    I'd like to write a rule to retrieve some values from a string like this (the number of networks may changes)

    50%w 15u%c - _network1(44/46 95%) _network2(12/13 92%) _networkn(31/41 75%)

    The rule should create 3 different rrd files:

        push @s, [networkn, [data, GAUGE, 'value'] ];

    where 'value" is
    95 for network1
    92 for network2
    75 for networkn

    Thanks for the support

  • Eric

    Eric - 2013-03-18

    Sorry, it's maybe too late, but I just discovered this forum.

    The following rule should answer your question assuming that the
    example you gave is from the output string of the plugin (and not perfdata).
    You should also have a more specific pattern to match your service.

      my @_networks = /_(network[\d\w]+)\(\d+\/\d+ (\d+)%\)/g;
      while ( my($_network, $_percent) = splice @_networks,0,2 ) {
        push @s, [ $_network , [ 'data', GAUGE, $_percent] ];

    Note: I have not tested the code, but it should be something similar to that.

    • Eric

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks