Sensu plugins-Please help me!

Hi Folks,

I’m working on integration on rundeck + sensu and i have ngnix webserver installed,i would like to monitor the http url status of ngnix on sensu and add annotation and webhooks to run the rundeck job automatically when ngnix process is down.

Can someone please be able to provide the script or yaml/json file to monitor the http check and i can test it.
Thanks in advance.

Thanks
Shamya

  1. What have you already tried? Please include links to gists and/or code blocks (if relatively small)
    i’ve tried this example and tried adding the asset with sensuctl but i get parsing erros.
    type: CheckConfig
    api_version: core/v2
    metadata:
    annotations:
    sensu.io/plugins/sensu-rundeck-handler/config/actions: |
    [
    {
    “webhook”: “8TlVUt1CQcbD3K5fiGGKNR1zBg7lnZsS#RestartNGINX”,
    “occurrences”: [ 3 ],
    “severities”: [ 1, 2 ]
    },
    {
    “rundeck_job”: “37044c9f-79e2-435e-bc03-db81995cc99e”,
    “occurrences”: [ 6 ],
    “severities”: [ 1, 2 ]
    }
    ]
    spec:
    handlers:
    • sensu-rundeck-handlers
  2. Tell us about your setup, this should include OS, version of Sensu, version of Sensu components (redis, rabbitmq), plugin versions (if applicable), anything special about your setup such as an airgapped network or strict ACLs
    I have rundeck on ubuntu vm1,ngnix,sensu go running on ubuntu vm2

NOTE: The Rundeck handler requires a valid Sensu license to be installed. If you do not have a license, you will need to request a trial license. You will have to contact sales for this.

The rest of these instructions assume you have Rundeck up and running and that it has:

  1. The node (vm2) defined
  2. A job configured that can restart NGINX on the node (test this by manually running the job)
  3. A webhook configured to execute the above job and that it has the Node Filter set to name: ${data.entity.metadata.name}

Add assets for the handler and the check:

sensuctl add sensu/sensu-rundeck-handler
sensuctl add nixwiz/http-checks

Create the handler (substituting your URL in the —api-url argument):

sensuctl create << EOF
---
type: Handler
api_version: core/v2
metadata:
  name: sensu-rundeck-handler
spec:
  command: sensu-rundeck-handler  --api-url http://rundeck.example.com:4440/
  type: pipe
  runtime_assets:
    - sensu/sensu-rundeck-handler
  filters:
    - not_silenced
EOF

Create the check (substituting the URL to check, your configured Rundeck webhook, and a subscription that your agent (vm2) is subscribed to):

sensuctl create << EOF
--
type: CheckConfig
api_version: core/v2
metadata:
  name: http-check
  annotations:
    sensu.io/plugins/sensu-rundeck-handler/config/actions: |
      [
        {
          “webhook: "8TlVUt1CQcbD3K5fiGGKNR1zBg7lnZsS#RestartNGINX",
          "occurrences": [ 3 ],
          "severities": [ 1, 2 ]
        }
      ]
spec:
  command: http-check --url http://example.com
  subscriptions:
  - system
  runtime_assets:
  - nixwiz/http-checks
  handlers:
    - sensu-rundeck-handler

Thanks so much Todd!
Much Appreciated.

I’ve followed your instructions and added the http-checks successfully.
I tried to test it by bringing down the ngnix but seems like entity is not down(see attached).

I don’t have Rundeck and SensuGo licenses. For this integration setup to be working do i install the both the licenses.
Please advise.
Below is my setup.
I have rundeck on ubuntu vm1
ngnix,sensu go running on ubuntu vm2 - is this setup works?

Thanks
Shamya

There is nothing attached for me to see.

The Sensu Go license is required to run the handler to kick off your remediation job. This should work without a license for Rundeck.

Thanks Todd for your reply.

I’ve contacted the Sensu support team to provide the license file.
Hopefully they get back to me.

I couldn’t able to test the rundeck job(ngnix restart) itself on rundeck because it says project execution is disabled even though i tried to activate it goes back to disabled automatically.
I’m guessing this because of no licenses.

Thanks
Shamya

HI Todd,

I wasn’t able to attach the pictures in this post i get some error.
Could you please provide your email id.I can post them through email.

Thanks
Shamya