mac-stats

command module
v0.0.0-...-58fb5c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 18 Imported by: 0

README

Build Status

mac-stats

Fetches battery and SSD info and stores in a Postgres DB.

Tested under Catalina (10.15.7)

install

  • build go binary
  • create the database, see schema
  • config database, the config file needs to be either in the current dir or in ~/.config

change the config file

display example

With grafana and query

SELECT
  stamp AS "time",
  ((metrics->>'UnitRead')::integer) AS "Unit Read"
FROM
  ssd
WHERE
  $__timeFilter(stamp)

scheduling

  • update plist file
  • start the job launchctl load mac-stats.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>laurent.mac-stats</string>

  <key>ProgramArguments</key>
  <array>
    <string>/Users/laurent/go/bin/mac-stats</string>
  </array>

  <key>StartInterval</key>
  <integer>3600</integer>

  <key>RunAtLoad</key>
  <true/>

  <key>StandardErrorPath</key>
  <string>/tmp/mac-stats.err</string>

  <key>StandardOutPath</key>
  <string>/tmp/mac-stats.out</string>
</dict>
</plist>

requirements:

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL