Control your garage door from your Android watch

The need (or want I should say):

I want to simplify getting into my garage when returning home on my motorcycle. It’s not fun to have to search around the garage door clicker or get off the bike and go enter the code….so why not make it so I can use my voice to open it from my Android wear watch.

What I have:

Watch: Nixon Mission (http://www.nixon.com/us/en/mens-model-mission) – I’ve used the Moto 360 as well, any Android Wear device should work
Android Phone: Samsung S7 Edge (any ANdroid phone should work)
Android Software: Tasker (https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=en) & Wear Tasker (https://play.google.com/store/apps/details?id=com.cuberob.weartasker&hl=en)
Garage Controller: Zenotech beagle done cape (http://zenotec.net/)
Command Center: Home Assistant (https://home-assistant.io/)

How it comes together:

The intention of this post is not to hold ones hand through the process step-by-step, but to share the framework used to make it work. If someone does have questions on any specifics, please post them in the comments and I’ll share more specifics in that area.

Home Assistant

Configuration

https://github.com/RickB17/home-assistant/blob/master/configuration.yaml

Scripts

Script used to use the garage door sensor:

Note: You’ll want to setup certificate based authentication between your hass (Home-Assistant) server and the garage door controller

https://github.com/RickB17/home-assistant/blob/master/Garage-State.sh

Tasker

https://github.com/RickB17/home-assistant/blob/master/tasker.txt

 

Full NGINX Plus Logs in Sumo Logic

You enabled the additional logging per the NGINX documentation for Amplify and now you want to have all the metrics show up in Sumo Logic; right?

Here’s what you came for:

_sourceCategory="NGINX Plus"
| parse regex "^(?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
| parse regex "(?[A-Z]+)\s(?\S+)\sHTTP/[\d\.]+\"\s(?\d+)\s(?[\d-]+)\s\"(?.*?)\"\s\"(?.+?)\"\s\"(?\S+)\"\s\"(?\S+)\"\ssn=\"(?\S+)\"\srt=(?\S+)\sua=\"(?\S+)\"\sus=\"(?\S+)\"\sut=\"(?\S+)\"\sul=\"(?\S+)\"\scs=(?\S+).*"

Want to play around and learn more about RegEx? I recommend you use this site: http://regexr.com/

References:
NGINX Log File Configuration : https://github.com/nginxinc/nginx-amplify-doc/blob/master/amplify-guide.md#additional-nginx-metrics

Reject Requests without a Host Name Header on NGINX

The Objective: Reject all requests that reach the NGINX server with our a host name in its header

Why it matters: When a request is made to via IP address (http://your.add.rress.here), it will return what is determined to be the “default server” for that IP address. This is often not the desired result. The result we are going for here is to close the connect with the requesting client.

The solution: 

  1. generate a bogus cert and store it in your /etc/nginx/certs/bogus/ (or  whichever folder you use for your certificates)
  2. create a “default.conf” configuration file in your /etc/nginx/conf.d/ (or whichever folder you include in your config)
  3. add the configuration to the “default.conf” file (update it if your folders are different for certs)
  4. test your configuration (/usr/sbin/nginx -t -c /etc/nginx/nginx.conf)
  5. if all is well, restart your service (sudo service nginx restart)
  6. validate it’s working as intended

Code Sample:
server {
listen 80 default_server;
server_name "";
return 444;
}
server {
listen 443 default_server ssl;
server_name "";
return 444;
ssl on;
ssl_certificate /etc/nginx/certs/bogus/cert.pem;
ssl_certificate_key /etc/nginx/certs/bogus/privkey.pem;
}

 

References:

  • http://nginx.org/en/docs/http/request_processing.html#how_to_prevent_undefined_server_names

Atlassian Monitoring with JMX (Java Management eXtension)

Want to know some details on what’s going on with your Atlassian application? (JIRA, Confluence, any JVM application).

 

Add these lines your Java Options:

-Dcom.sun.management.jmxremote.port=8686
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=SERVER.DOMAIN.COM

Create a jmxremote.password file

  1. Copy C:\Program Files\Atlassian\JIRA\jre\lib\management\jmxremote.password.template to C:\Program Files\Atlassian\JIRA\jre\lib\management\jmxremote.password
  2. Edit jmxremote.password to add your credentials
  3. Set permissions on jmxremote.password
    1. Set owner the the user your Atlassian application runs as
    2. Remove inheriting permissions
    3. Remove all account permissions except for owner
    4. save your settings

Start your service & launch jconsole

Note: Running jconsole.exe -debug is helpful for troubleshooting

Use your favorite monitoring tool to collect the stats

SolarWinds SAM module supports JMX

Run nginx in a Docker container on a Synology

In this walk through we will perform the following:

Note: The actual nginx configuration will not be covered here.

  1. Deploy the nginx Docker container (vr-ngx-01)
  2. Mount the following folders and file:
    1. /etc/nginx/conf.d/
      1. it’s assumed your sites .conf file is in this director
    2. /etc/nginx/certs/
      1. it’s assumed your SSL certs live here and are properly referenced in your /etc/nginx/conf.d/your.site.conf
    3. /etc/nginx/nginx.conf
      1. it’s assumed SSL is configured and includes conf.d/*.conf
  3. Link vr-ngx-01 to the Home-Assistant container (vr-hass-01)
  4. Fire up the container and verify connectivity over a secured connection
  5. Remove local port mapping for vr-hass-01

1. Deploy the container

2. Mount the local folders & file

3. Link vr-ngx-01 to vr-hass-01

4. Verify site loads

Browse to https://YOUR-SYNOLOGY-NAME:4443

Note: to make this appear at https://www.virtualrick.com you can configure your router/firewall for port forwarding. Example: external TCP 443 forwards to internal TCP 4443.

5. Remove local port mapping for vr-hass-01

Now that the nginx container is linked to the home-assistant container, there is no need for the home-assistant service port (8123) to be available directly.

Make sure the home-assistant container is turned off, then edit the container and remove the local port configuration.

Running Home-Assistant in a Docker container on a Synology NAS

Update: Link to post following this one with steps for deploying nginx as a proxy for the Home-Assistant container deployed here: CLICK HERE

 

 

I recently received my Synology DS716+ and discovered it supports running Docker containers. I figured why not run Home-Assistant in a Docker container on the Synology? Doing this will free my Raspberry Pi for another project. Here is what I did to make this happen.

Mount Points:

/config

Store your configuration.yaml here

/scripts

Store any scripts called within your confiruation.yaml. I have a number of scripts used to execute remote commands on various devices.

/root/.ssh

I mount this folder so I can store the keys that are trusted on remote devices

Step by step screenshots

Download the image

Create the container

Launch the application

JIRA : Limit which resolutions are displayed on a screen

  1. Select the workflow transition
  2. Edit the properties
  3. Add the “jira.field.resolution.include” property with values matching the resolution ID’s you want to display

 

How to identify the resolution id

  1. Administration > Issues > Issues Attributes > Resolutions
  2. Mouse over the resolution
  3. observe the ID in the URL
    1. Example: https://JIRASITE/secure/admin/EditResolution!default.jspa?id=10100

 

Performance Monitoring for Atlassian Applications (JIRA, Confluence on Windows)

Who doesn’t want to know how their applications are performing? Here’s a quick way to start collecting data and analyzing it.

  1. Sign-up for a free New Relic account
  2. Download your New Relic java agent zip file to your server and extract. I placed mine in the “D:\Program Files” folder.
  3. Edit “D:\Program Files\newrelic\newrelic.yml”
    1. update the “license_key” and “app_name” variables
      1. note: the license_key is surrounded in ticks ” and app_name is not.
  4. Configure the java agent to start when the service starts
    1. start > run > regedit.exe
    2. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\[App ID]\Parameters\Java
    3. edit “Options” by adding “-javaagent:D:\Program Files\newrelic\newrelic.jar” to the bottom
  5. Restart your application service

If your app doesn’t show up in the console check your logs! (D:\Program Files\newrelic\logs\newrelic_agent.log)