Skip to content

dvadgama/collectd_splunkData

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

collectd_splunkData

A collectd Python Plugin for SplunkData

####Why? While curl_json/curl_xml plugin works to get the 90% of the information via REST API end points suchs as

  • server/introspection/indexer
  • status/resource-usage/splunk-processes
  • server/status/resource-usage/hostwide

There are certain end points which holds the useful information and, return it back to you as CDATA JSON string. example of such a endpoint is

  • introspection/kvstore/serverstatus

and , JSON out put looks like this

{
"links":
    {
    },
    "origin": "https://localhost/services/server/introspection/kvstore/serverstatus",
    "generator":
    {
        "build": "1",
        "version": "x.y.z"
    },
    "entry":
    [
        {
            "name": "serverStatus",
             "data":  {"host": "localhost","connections": { "available":10 , "current":2,"toalCreated":3  }" ,
             .....
             .....
	}
   ],
 . . .
 . . .
}

observer the highlighted area, it not a JSON but CDATA , i.e. json embaded as a value of field/key data and, curl_json,curl_xml will not be able to process it because it is a VALUE and , those plugins can only display it. As they are suppose to.

Hence, We need another plugin which can extract these information from these CDATA ( by converting it into JSON :) )

Leaf Key/Parameters

  • Host: host name of your splunk api server ( Note that API server is not same as the web front end of splunk )
  • Port : port on which splunk responses
  • userName: your splunk login
  • userPasswor: your splunk password
  • URL: API endpoint , do not forget to add output_mode=json at the end. Yes, this plugin can not handle the xml data
  • Type: specify one of the collectd data type, as found in types.db
  • Verbose: A bollen value , which is False by default & if set to true it will print lot of debugging messages!

node Key/Paramters

  • Path: it is a Forward-slash ( i.e. '/' ) seperated path to where your value of interest lies

i.e. refering to above example , if i want to know availabe connections , i would use

< Path "connections/available" >
      Type "gauge"
< /Path >

Notes

  • place the python module in a directory say /my/collectd/plugins/python before using it.
  • Refer to the splunk.conf for Plugin(splunkData) configuration and, collectd python for Python Plguin configuration in general
  • I used redis-collectd-plugin as refrence while developing this plugin
  • It can not handle the json arry objects yet but, it seems we may not need to support it anyway , if you have a reason , ping me!

About

A collectd Python Plugin for SplunkData

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages