Skip to content
README.md 2.99 KiB
Newer Older
Kevin Lyda's avatar
Kevin Lyda committed
# GQ GMC

This is a web service interface for GQ GMC geiger counters.

## Installation

Note this is not yet complete.

```bash
go get -u gitlab.com/lyda/gqgmc/cmd/gqgmcd
```

Kevin Lyda's avatar
Kevin Lyda committed
## Configuring

Command line:

```
Usage of gqgmcd:
      --config string           Config file (default "gqgmc.conf")
      --device string           Device for Geiger Counter (default "/dev/gqgmc")
      --listen-address string   Address for HTTP requests (default ":8080")
      --model string            Model of Geiger Counter (default "gqgmc")
      --sleep-cycle int         Seconds to sleep per cycle. (default 5)
      --static-dir string       Static files directory (default "static")
      --template-dir string     Template directory (default "templates")
```

The config file uses the same variables (not `config` obviously)
but with any dashes replaced with underscores. So
`static_dir = /var/lib/gqgmcd/static` for instance.

## Prometheus variables

Kevin Lyda's avatar
Kevin Lyda committed
There is a sample `prometheus.yml` configuration in the `docs/prometheus/`
directory.  See the Prometheus
[getting started](https://prometheus.io/docs/introduction/getting_started/)
docs for more information.

* `gqgmc_geiger_cpm` (histogram) CPM readings.
* `gqgmc_geiger_cps` (histogram) CPS readings.
* `gqgmc_power_volts` (histogram) Voltage readings.
Kevin Lyda's avatar
Kevin Lyda committed
* `gqgmc_sys_errors` (gauge) Error counts. Records problems
  communicating with the device.

Kevin Lyda's avatar
Kevin Lyda committed
There are also sample consoles in the `docs/prometheus/` directory. Add this
to the left hand side menu in `menu.lib` your prometheus install:

```
{{ if query "up{job='gqgmc'}" }}
{{ template "_menuItem" (args . "gqgmc.html" "GQGMC") }}
{{ if match "^gqgmc" .Path }}
  {{ if .Params.instance }}
  <ul>
    <li {{ if eq .Path "gqgmc-overview.html" }}class="prom_lhs_menu_selected"{{ end }}>
      <a href="gqgmc-overview.html?instance={{ .Params.instance }}">{{.Params.instance }}</a>
    </li>
  </ul>
  {{ end }}
{{ end }}
{{ end }}
```

![Prometheus Console](/docs/gqgmc.png)

Kevin Lyda's avatar
Kevin Lyda committed
## Configuring udev

Copy the `linux/51-gqgmc.rules` file to the `/etc/udev/rules.d`
directory and force the reload of udev rules:

```bash
sudo cp ./51-gqgmc.rules /etc/udev/rules.d/51-gqgmc.rules sudo
udevadm control --reload-rules
```

Disconnect the GQ GMC-300 from the computer and then reconnect.
Verify that there exists a `/dev/gqgmc` in the `/dev` directory
with read/write permission for all users.

```bash
ls -la /dev/gqgmc
```
Kevin Lyda's avatar
Kevin Lyda committed

## Development Resources

There's a GQ Electronics [forum](https://www.gqelectronicsllc.com/forum/) which
isn't hugely active, but some really good info and helpful people
there. If you follow the git log on this project you'll see this
is based off a C++ implementation which is
[over on sourceforge](https://sourceforge.net/projects/gqgmc/)

## TODO

There's still a fair bit to do. This works good enough for my purposes so
I'm not likely to do much more. I've seeded the
[issue tracker](https://gitlab.com/lyda/gqgmc/issues) with the obvious
issues.
[Merge Requests](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html)
welcome!