Closed tonyppe closed 5 years ago
Okay I have made progress on this but I am still unable to get client static checks deployed to clients.
The check was being deployed to plugins/ directory on the client, so I checked the docs again and looked into the playbook that is deploying this and noticed the error there:
This is what I wanted:
So I moved the check to: data/static/sensu/definitions/cpucheck.json.j2
This has the desired result of the master being deployed with this check with a static subscription for a client.
Regarding the client checks, how is this invoked from the point of view of deploying a static check on a client system?
Hey @tonyppe,
Thanks for filing an issue! Sounds like you've been able to make sense of the data store structure to get a check deployed to your Sensu master. Just to make sure I'm following, are you trying to deploy a standalone
check to a Sensu client now? If so, that support was added back in https://github.com/sensu/sensu-ansible/pull/112/files#diff-4e353f7f1d19cba51d0eb54828917568R114 but, I haven't personally used it too heavily.
--- EDIT ---
To add, if you're looking for more realtime help, feel free to swing by the Sensu community chat https://slack.sensu.io/ there's both the #help
room for generic help and then #ansible
for Ansible specific things. I also think if you put the check definition in {{ static_data_store }}/sensu/client_definitions/{{ hostgroupname }}
the role will deploy them for ya.
Excellent! Yes you are correct, trying to get standalone checks deployed as well. I will check out the chat, thanks very much for the help :)
I am still using Ansible Tower for this and setting the "static_data_store:" to be a specific location on the host is somewhat of a problem (I moved servers and completely forgot to update this specific location on the new server). Do you know if it's possible to set this to be a relative position within the git directory? Unfortunately it's not a home directory or I may have been able to use something like ~/sensu/data
Thanks again 👍
Hey @tonyppe
I've never used Ansible Tower but, I think you should be able to set static_data_store
to any relative path (or one in your repo) and this role should 'just use it'. That said, I don't know how Ansible Tower is cloning the repo's and such, so perhaps it's having some weird limitations? Have you tried just configuring it and did it error?
Hi Jared, the path is relative to the root /, but I think if it can be set relative to the git directory (git pull) or equivalent playbook directory then when I push/pull from my local git then the static_data_store variable wouldnt need to be updated to each system where the playbooks are running. At the moment it's set to the full path, something like /var/lib/awx/project/_something/data/static. But it's easily worked around... (ie not really a problem but a question)
I'm using the AWX version of Anisble Tower (open source) and the way in which it clones the repo is like the following:
# from galaxy
- src: sensu.sensu
Hey @tonyppe,
Would setting static_data_store
to something like files/static_data_store
and then dumping everything into the files
directory in this role work? I'm going through where we use static_data_store
in this rile and that seems like it might work. Would be interested to get any errors you have when running this role if it doesn't.
Hi! I'm going to close out this issue but, if you still need help here, please let us know. More than happy to help troubleshoot. Additionally, if you would like more "real time" support, feel free to join us in our Community Slack room, #ansible
. Checkout https://sensu.io/community for more details!
Where is the "static_data_store" default go to? The docs say "By default it's set to the playbook directory, but it can be changed to any location." What is "the playbook directory"? Apologies if this is a dumb question. I am using Ansible Tower for this work.
I have changed the static store via this in group_vars/all.yml: static_data_store: /var/lib/awx/projects/_14__sensu/data/static
And in the I have a json file renamed to json.j2 located in: data/static/sensu/checks/sensu_servers/cpucheck.json.j2
I am still continuously unsuccessful in being able to get this deployed to a client or server.
The guide / docs dont really go into much detail about how to write the checks so that they can be deployed with this role. Do I have to write j2 files or can we just put the .j2 at the end of the tested and working .json ? Also as I understand it the directory path is what matches the hosts from the inventory here? So I am understanding that the data/static/sensu/checks/sensu_servers/ directory / checks, will match the group variable of "sensu_servers" and deploy to those hosts?
Is it possible to set the data store variable as a path from the root of the working git directory? Or do I have to give a server-specific directory path?
My only check right now is quite basic, it was implemented on a manual sensu install and now i'm working on this via ansible. The cpucheck.json is:
{ "checks": { "CPU_Status": { "handlers": ["mailer"], "command": "/opt/sensu/embedded/bin/check-cpu.rb -w 80 -c 90 ", "interval": 60, "occurrences": 5, "subscribers": [ "sensu_client" ] } } }
Thanks in advance for any tips. I am 99% sure I'm doing something wrong here but have been unable to find the info needed to work through it.