All Apps and Add-ons

Scripted Input for RRD database: How to troubleshoot error "fetch() takes exactly 2 arguments (3 given)"?

theouhuios
Motivator

Hello

I am trying to get ganglia data into splunk and I see error in _internal. The error which is I see is fetch() takes exactly 2 arguments (3 given)

[script:///mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/__SummaryInfo__/dfs.namenode.BlockReportNumOps.rrd]
interval = 600
sourcetype = collectd
source = readrrd.sh
#disabled = false
#index=test

I changed the step Value for this in the script based on the rrdtool's output.

rrdtool info /mnt/var/log/ganglia/rrds/__SummaryInfo__/dfs.namenode.BlockReportNumOps.rrd
filename = "/mnt/var/log/ganglia/rrds/__SummaryInfo__/dfs.namenode.BlockReportNumOps.rrd"
rrd_version = "0003"
step = 15

Errors in _internal logs are:

03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd" TypeError: fetch() takes exactly 2 arguments (3 given)
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"     return self.backend.fetch(*data)[returnStyle]
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"   File "/usr/lib/python2.6/site-packages/PyRRD-0.1.0-py2.6.egg/pyrrd/rrd.py", line 226, in fetch
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"     data = rrd.fetch(cf=cf, resolution=resolution, start=start, end=end)
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"   File "/mnt/splunk/etc/apps/search/bin/readrrd.sh", line 53, in dump_rrd
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"     dump_rrd(filename, STEP, CONSOLIDATION_FUNCTION, None, FETCH_INTERVAL, TIME_FORMAT)
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"   File "/mnt/splunk/etc/apps/search/bin/readrrd.sh", line 100, in main
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"     main(sys.argv)
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh /mnt/var/log/ganglia/rrds/AMZN-EMR/ip-10-162-5-172.ec2.internal/dfs.datanode.ReplaceBlockOpNumOps.rrd"   File "/mnt/splunk/etc/apps/search/bin/readrrd.sh", line 104, in <module>
03-21-2015 17:26:44.643 -0400 ERROR ExecProcessor - message from "/mnt/splunk/etc/apps/search/bin/readrrd.sh 

Any help would be great. Thanks

0 Karma

tjohnston2
Splunk Employee
Splunk Employee

theohuios,
Can you tell me if you are still ingesting Ganglia data in Splunk and what your use case is. I have another customer asking if Splunk can ingest Ganglia data.

Thank you

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Move the argument you're trying to pass to the .sh in inputs.conf into the .sh itself and out of inputs.conf.

martin_mueller
SplunkTrust
SplunkTrust

From a scripted inputs point of view in Splunk you're now good.

What remains is to track down the actual error message that's being thrown somewhere deep down your script using the stacktrace dumped into your _internal index.

0 Karma

theouhuios
Motivator

@martin_mueller

I added the filename as a global variable

FETCH_INTERVAL = 600 # in seconds
STEP = 15
CONSOLIDATION_FUNCTION = "AVERAGE"
TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
filename = "/mnt/var/log/ganglia/rrds/__SummaryInfo__/dfs.namenode.BlockReportNumOps.rrd"

and commented the arg part. Not sure if this is right though.

def main(args):
    #if (len(args) != 2):
    #    sys.exit(1)
    #filename = args[1]
    dump_rrd(filename, STEP, CONSOLIDATION_FUNCTION, None, FETCH_INTERVAL, TIME_FORMAT)


#if (__name__ == '__main__'):
#    main(sys.argv)

Any suggestions?

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Does your inputs.conf stanza now look like this?

[script://path/script]

Instead of like this?

[script://path/script parameter]
0 Karma

theouhuios
Motivator

yup. Thats how it is now.

0 Karma
Did you miss .conf21 Virtual?

Good news! The event's keynotes and many of its breakout sessions are now available online, and still totally FREE!