[solved] Not all multi output fields are parsed

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Z.Beeblebrox
Posts: 5
Joined: Fri May 08, 2009 1:20 pm

[solved] Not all multi output fields are parsed

Post by Z.Beeblebrox »

I've written a small perl script to get memory utilization statistics from Windows hosts. Sript output is like this:

Code: Select all

$ perl ncnet_memory_utilization.pl 10.0.1.1
available:483495900 cache:36450300 pool_paged:65581060 pool_nonpaged:33308670 sys_code:802816 sys_driver:2338816
Now in Cacti I have added a new data input method for my script with mappings for all 6 output values. Data and graph template are added too.

The problem is this:

Code: Select all

05/13/2009 11:20:11 PM - CMDPHP: Poller[0] Host[13] DS[271] CMD: perl /usr/share/cacti/site/scripts/ncnet_memory_utilization.pl dc1.test.local, output: available:567767000 cache:41492480 pool_paged:65630210 pool_nonpaged:33316860 sys_code:802816 sys_driver:2338816

05/13/2009 11:20:12 PM - POLLER: Poller[0] Parsed MULTI output field 'cache:41492480' [map cache->nc_mem_cache]
05/13/2009 11:20:12 PM - POLLER: Poller[0] Parsed MULTI output field 'pool_paged:65630210' [map pool_paged->nc_mem_paged]
05/13/2009 11:20:12 PM - POLLER: Poller[0] Parsed MULTI output field 'pool_nonpaged:33316860' [map pool_nonpaged->nc_mem_nonpaged]
05/13/2009 11:20:12 PM - POLLER: Poller[0] Parsed MULTI output field 'sys_code:802816' [map sys_code->nc_mem_sys_code]
05/13/2009 11:20:12 PM - POLLER: Poller[0] Parsed MULTI output field 'sys_driver:2338816' [map sys_driver->nc_mem_sys_driver]
Script output seems ok, but the poller don't map the first value to the data source. I've double checked case and spelling of all parameters and can't find a typo.

Other multi output scripts are working fine.

Thanks for any hint.
Last edited by Z.Beeblebrox on Sun May 17, 2009 3:43 pm, edited 1 time in total.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Please post the screenshot of the data input method with the mappings of the parameters.
Z.Beeblebrox
Posts: 5
Joined: Fri May 08, 2009 1:20 pm

Post by Z.Beeblebrox »

The full "Input String" is:

Code: Select all

perl <path_cacti>/scripts/ncnet_memory_utilization.pl <ip>
This is my perl-script:

Code: Select all

#!/usr/bin/perl
# Usage:
#  script.pl <host>
#
#  returns 6 values:    available, cache, pool_paged, pool_nonpaged,
#                       sys_code, sys_driver

# path to check_nc_net tool
$check_nc_net = "/usr/lib/nagios/plugins/check_nc_net";
$port = 1248;

# take care for tcp:hostname or TCP:ip@
$host = $ARGV[0];
$host =~ s/tcp:/$1/gis;

sub run_check {
        my $counter = shift(@_);

        $resp = `$check_nc_net -H $host -p $port -v COUNTER -l \"$counter\"`;
        chomp $resp;
        ($ret) = ($resp =~ /.* = (\d+)/);

        return $ret;
}

$v1 = run_check("\\Memory\\Available Bytes");
$v2 = run_check("\\Memory\\Cache Bytes");
$v3 = run_check("\\Memory\\Pool Paged Bytes");
$v4 = run_check("\\Memory\\Pool Nonpaged Bytes");
$v5 = run_check("\\Memory\\System Code Total Bytes");
$v6 = run_check("\\Memory\\System Driver Total Bytes");

print "available:$v1 cache:$v2 pool_paged:$v3 pool_nonpaged:$v4 " .
        "sys_code:$v5 sys_driver:$v6\n";
Output from "rrdtool info" on the specific .rrd-file:

Code: Select all

$ sudo rrdtool info /var/lib/cacti/rra/server_-_dc1_nc_mem_avail_271.rrd
filename = "/var/lib/cacti/rra/server_-_dc1_nc_mem_avail_271.rrd"
rrd_version = "0003"
step = 300
last_update = 1242289207
ds[nc_mem_avail].type = "GAUGE"
ds[nc_mem_avail].minimal_heartbeat = 600
ds[nc_mem_avail].min = 0.0000000000e+00
ds[nc_mem_avail].max = NaN
ds[nc_mem_avail].last_ds = "U"     <-- !
ds[nc_mem_avail].value = NaN       <-- !
ds[nc_mem_avail].unknown_sec = 7
ds[nc_mem_cache].type = "GAUGE"
ds[nc_mem_cache].minimal_heartbeat = 600
ds[nc_mem_cache].min = 0.0000000000e+00
ds[nc_mem_cache].max = NaN
ds[nc_mem_cache].last_ds = "38785020"
ds[nc_mem_cache].value = 2.7149514000e+08
ds[nc_mem_cache].unknown_sec = 0
ds[nc_mem_paged].type = "GAUGE"
ds[nc_mem_paged].minimal_heartbeat = 600
ds[nc_mem_paged].min = 0.0000000000e+00
ds[nc_mem_paged].max = NaN
ds[nc_mem_paged].last_ds = "65548290"
ds[nc_mem_paged].value = 4.5883803000e+08
ds[nc_mem_paged].unknown_sec = 0
...
/edit:
I'm using the Debian package of Cacti v0.8.7d on "sid" with rrdtool v1.3.1.
Attachments
Screenshot - 14.05.2009 , 10_04_26.png
Screenshot - 14.05.2009 , 10_04_26.png (32.49 KiB) Viewed 2269 times
graph.png
graph.png (33.46 KiB) Viewed 2269 times
Z.Beeblebrox
Posts: 5
Joined: Fri May 08, 2009 1:20 pm

Post by Z.Beeblebrox »

Something is very strange here.

I've made a new script with two output parameter: p1 and p2.
Then I've created a new data input method calling this script and referencing these two parameter. After this I created a new data template and a graph for this test.

Result: 1st output parameter in my data input method-list is not parsed. I've reconfigured my perl script, so that the output parameter "p1" is on the 2nd position. Same result.

The solution was, to delete the 1st output parameter on my data input method and add it again with the same content. The only difference is, that this parameter reference now has a new id in the database. Then I've opened the data template, checked the reference to the output field (it was correct) and although saved it.

Now it works. But why?

Same procedure for the other data input method (this one I've posted in this thread) and it works too. ?!

I think, that I make a mistake while creating the data input method or while creating the data template for multiple output fields, but I don't know what this could be.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

When changing data input methods, please take care to "repopulate" the poller cache
Reinhard
Z.Beeblebrox
Posts: 5
Joined: Fri May 08, 2009 1:20 pm

Post by Z.Beeblebrox »

Nice, that's it.

Thank you very much. :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests