# Sensu Go backend and environment variables

**URL:** <https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469>\
**Category:** Sensu Plugins\
**Created:** [December 1, 2019, 8:32pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469 "2019-12-01T20:32:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 1, 2019, 8:32pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/1 "2019-12-01T20:32:00Z")

</div>

I am testing with a brand new install of a clustered Sensu Go (5.15.0).  
Current problem: Assets are not downloaded due to HTTP\_PROXY not being used.

First attempt:  
I found several postings on that and entered HTTP\_PROXY=http://my.proxy.host:port into /etc/default/sensu-backend or /etc/sysconfig/sensu-backend (I am on CentOS 7).  
Result: sensu-backend does not finish starting, only etcd is started (to be seen by list of open ports).  
Adding a NO\_PROXY list does not remedy that.

Second attempt:  
Just entered HTTPS\_PROXY into /etc/sysconfig/sensu-backend. Now sensu-backend is starting up fine, but it does not use the proxy for https connections to [assets.bonsai.sensu.io](http://assets.bonsai.sensu.io):  
error getting assets for event: error fetching asset: Get [https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks\_4.0.0\_centos\_linux\_amd64.tar.gz:](https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks_4.0.0_centos_linux_amd64.tar.gz:) dial tcp 13.224.196.28:443: i/o timeout

Third attempt:  
I tried to find a way to download the asset manually and feed the tar.gz file into sensu-backend, but so far I came up empty.  
Is this possible as a workaround?

Best regards,  
Dirk

---

<div class="post-metadata">

**Author:** ![todd](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/todd/32/936_2.png) [@todd](https://discourse.sensu.io/u/todd)\
**Post date:** [December 2, 2019, 4:21pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/2 "2019-12-02T16:21:41Z")

</div>

Dirk,

In regards to your first attempt, can you expand on what you used for NO\_PROXY in comparison to how you configured the backend URLs? Were they all IP addresses, hostnames, or a combination of both?

---

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 2, 2019, 7:16pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/3 "2019-12-02T19:16:35Z")

</div>

Todd,  
I tried “NO\_PROXY=”.sccon.de" because I found documentation stating that ip addresses should not be used in the NO\_PROXY env variable.  
Now since you ask I retried entering ip addresses also, and now sensu-backend does start up fully and is accessible.

But the HTTPS\_PROXY env variable still seems not to be used because the main problem is still the same: Assets cannot be loaded.

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [December 2, 2019, 7:29pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/4 "2019-12-02T19:29:59Z")

</div>

@dirkhschulz, fwiw assets don’t _have_ to be loaded from Bonsai. You can mirror the packages on your own webserver, artifactory or internal github/lab/bitbucket instance. The only thing that matters is the URL and SHA512 sum.

---

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 2, 2019, 7:36pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/5 "2019-12-02T19:36:36Z")

</div>

aaronsachs-sensu  
thanks for hinting at that. To be honest I wanted to avoid the hassle of setting up an internal webserver for that and adding each package to it.

Isn’t there any way to load assets manually into sensu-backend like unpackaging the content into some directory or similar?

---

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 2, 2019, 7:49pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/6 "2019-12-02T19:49:29Z")

</div>

Just to be sure I tried downloading the asset through the http proxy manually, and that works:  
wget [https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks\_4.0.0\_centos\_linux\_amd64.tar.gz](https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks_4.0.0_centos_linux_amd64.tar.gz)  
–2019-12-02 20:47:50-- [https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks\_4.0.0\_centos\_linux\_amd64.tar.gz](https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks_4.0.0_centos_linux_amd64.tar.gz)  
Verbindungsaufbau zu 10.20.40.254:3128… verbunden.  
Proxy-Anforderung gesendet, warte auf Antwort… 200 OK  
Länge: 1269503 (1,2M)  
In »»sensu-plugins-cpu-checks\_4.0.0\_centos\_linux\_amd64.tar.gz«« speichern.

So the question is why the HTTP\_PROXY env variable is read but the HTTPS\_PROXY env variable is not.

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [December 2, 2019, 7:52pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/7 "2019-12-02T19:52:51Z")

</div>

@dirkhschulz You can certainly install plugins manually, though for the CPU check plugin you’re attempting to use, you will need to use the `sensu-install` tool that we publish (see [https://docs.sensu.io/sensu-go/5.15/installation/plugins/#installing-plugins-using-the-sensu-install-tool](https://docs.sensu.io/sensu-go/5.15/installation/plugins/#installing-plugins-using-the-sensu-install-tool)). For other assets, you can download them and place them into a directory that Sensu has access to and provide the full path to the command.

---

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 2, 2019, 7:59pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/8 "2019-12-02T19:59:43Z")

</div>

Or is there a way to completely mirror all assets from bonsai in one sweep?

---

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 2, 2019, 8:14pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/9 "2019-12-02T20:14:55Z")

</div>

aaronsachs-sensu  
I successfully installed sensu-install and installed the sensu-plugins-cpu-checks:

[SENSU-INSTALL] installing Sensu gem ‘sensu-plugins-cpu-checks’  
Fetching: mixlib-cli-1.7.0.gem (100%)  
Successfully installed mixlib-cli-1.7.0  
Fetching: sensu-plugin-4.0.0.gem (100%)  
Successfully installed sensu-plugin-4.0.0  
Fetching: linux-kstat-0.1.3-universal-linux.gem (100%)  
Successfully installed linux-kstat-0.1.3-universal-linux  
Fetching: sensu-plugins-cpu-checks-4.0.0.gem (100%)  
You can use the embedded Ruby by setting EMBEDDED\_RUBY=true in /etc/default/sensu  
Successfully installed sensu-plugins-cpu-checks-4.0.0

After that I restarted sensu-backend.

But still sensu-backend tries to download the asset:

error getting assets for event: error fetching asset: Get [https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks\_4.0.0\_centos\_linux\_amd64.tar.gz:](https://assets.bonsai.sensu.io/68546e739d96fd695655b77b35b5aabfbabeb056/sensu-plugins-cpu-checks_4.0.0_centos_linux_amd64.tar.gz:) dial tcp 13.35.253.65:443: i/o timeout

Do I have to change the asset definition to make sensu-backend aware of it being installed manually?

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [December 2, 2019, 8:18pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/10 "2019-12-02T20:18:24Z")

</div>

You’ll have to change your check definition for Sensu to stop attempting to download the asset. My hunch is that you’ve still got it listed in your check as part of `runtime_assets`. Remove it from there, and point the command to the executable (should be at `/opt/sensu-plugins-ruby/embedded/bin`).

---

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 2, 2019, 8:27pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/11 "2019-12-02T20:27:37Z")

</div>

thanks alot!  
that made it working.

---

<div class="post-metadata">

**Author:** ![dirkhschulz](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dirkhschulz](https://discourse.sensu.io/u/dirkhschulz)\
**Post date:** [December 6, 2019, 5:31pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/12 "2019-12-06T17:31:32Z")

</div>

Finally solved the primary problem: Assets could not be loaded because I entered HTTP\_PROXY only in /etc/sysconfig/sensu-backend, but not in /etc/sysconfig/sensu-agent.  
After adjusting /etc/sysconfig/sensu-agent, downloading assets from bonsai worked.

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [December 6, 2019, 9:35pm UTC](https://discourse.sensu.io/t/sensu-go-backend-and-environment-variables/1469/13 "2019-12-06T21:35:21Z")

</div>

Ah! Great to hear that you got it sorted.
