Open jamengual opened 10 years ago
Has chef been successfully run on the "splunk_server" node yet?
yes it did run successfully but the server ip is empty and that is what the search is for, to find the node: that has that attribute "splunk_is_server": "true" and then fill up the template
thanks.
do you meen in the splunk server itself ? in that case no because I don't need it since I need the client to be installed not the server and the cookbook that I'm using search on the chef server for a splunk server node and if found one then uses the ipaddress attribute to fill up the template.
Related to this, it would help if the README.md not only showed how to state a query but also showed a sample input json databag and a sample output query result for each query. As it is, a newbie user has no idea what to run the query against and what to expect as the type/format of the output.
@lonniev you have the chops to PR that?
Now that I have read over the code in the providers directory for the users
recipe, yes I probably could add the few lines of markdown that would illustrate how that search method returns an iterable array of json objects as the resultset.
However, I have my own code to debug and document and I'd prefer to stay focused there! ;-)
Hi.
I'm having a estrange issue with the search cookbook.
I created a data bag node :
{ "id": "splunk-server", "name": "splunk_server", "chef_environment": "_default", "json_class": "Chef::Node", "splunk_is_server": "true", "ipaddress ": "123.123.123.123", "automatic": { "hostname": "splunk.server.com", "os": "centos" }, "normal": { }, "chef_type": "node", "default": { }, "override": { }, "run_list": [ "role[monitoring]" ] }
but the result of the search was keep coming blank so I start printing variables on my recepies and I realize that this search :
splunk_servers = search(# ~FC003 :node, "splunk_is_server:true")
it returns empty but if I search for :node I can see : search(:node) result : node[splunk_server]
But the search above is trying to find on the chef server ( in this case the json file) all the nodes with the attribute "splunk_is_server": "true", but it doesn't seem to find it.
I'm doing something wrong on the json file ?
should I add those attributes to another section ?
Thanks.
PS : the template replacement code from the cookbook that I'm using https://github.com/opscode-cookbooks/chef-splunk/blob/master/templates/default/outputs.conf.erb
the original search code :
https://github.com/opscode-cookbooks/chef-splunk/blob/master/recipes/client.rb