Sunday, 23 July 2017

Docker installation on Ubuntu 16.04.2 with TCP API


  1. Install of Ubuntu 16.04.2.
  2. Follow the instructions on https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
  3. Modify /lib/systemd/system/docker.service change:
    • ExecStart=/usr/bin/dockerd fd://        ....to
    • ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
  4. Modify /etc/init.d/docker change:
    1. DOCKER_OPTS=
    2. DOCKER_OPTS="-H tcp://0.0.0.0:2375"
    Restart docker with:
    • sudo service docker restart
    You will see:

    Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.

    Do this as instructed:
    • systemctl daemon-reload
    ==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===
    Authentication is required to reload the systemd state.
    Authenticating as: David Bond,,, (david)
    Password:
    ==== AUTHENTICATION COMPLETE ===

    Then restart again

    • sudo service docker restart
    Check that docker is still available from the command line:
    • docker version
    Client:
     Version:      17.06.0-ce
     API version:  1.30
     Go version:   go1.8.3
     Git commit:   02c1d87
     Built:        Fri Jun 23 21:23:31 2017
     OS/Arch:      linux/amd64

    Server:
     Version:      17.06.0-ce
     API version:  1.30 (minimum version 1.12)
     Go version:   go1.8.3
     Git commit:   02c1d87
     Built:        Fri Jun 23 21:19:04 2017
     OS/Arch:      linux/amd64
     Experimental: false

    Check that the TCP socket is open for requests:
    • curl http://localhost:2375/version
    You will see:

    {"Version":"17.06.0-ce","ApiVersion":"1.30","MinAPIVersion":"1.12","GitCommit":"02c1d87","GoVersion":"go1.8.3","Os":"linux","Arch":"amd64","KernelVersion":"4.8.0-36-generic","BuildTime":"2017-06-23T21:19:04.990631145+00:00"}

    Monday, 10 July 2017

    Monday, 3 July 2017

    Soma FM Player

    Free music directly to your system tray! And it's open source...

    The project is here:  https://github.com/davidnmbond/SomaFm

    You can download the binary from here:  https://github.com/davidnmbond/SomaFm/releases

    There's a pretty installer:


    ...then the thing sits in your system tray with the lovely SomaFM red S:


    Start-up instructions:
    1. Press [Windows Key] and type Soma
    2. Press return when the SomaFM [S] appears.

    Operating instructions:
    • Left click to stop (the [S] turns green), left click again to start (the [S] turns red again).
    • Right click to change channel and modify settings.
    • Media keys will work if enabled (the default), including mute, play, volume up and down.
    • Right click and Click Exit to quit.
    Upgrade instructions: 
    1. Exit as per instructions, above
    2. Run the later version of the installer.

    Friday, 19 May 2017

    Monday, 20 March 2017

    A better c# string.Join supporting "and" or "or" for the final item

    C# developers often have to convert a list of items into a human-readable list.
    For example, if you have a string array: "a", "b", "c", "d", you may want the output to be:

    'a', 'b', 'c' and 'd'

    Here is a way to do that using a C# extension method:

    Comment welcome.  I will update with improvements as suggestions come in:

    Extension method:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
      public static string ToHumanReadableString(this IEnumerable<object> enumerable, string quoteWith = "'", string delimitWith = ", ", string delimitLastWith = " or ")
      {
       if (enumerable == null)
       {
        return string.Empty;
       }
       var list = enumerable.ToList();
       return !list.Any()
        ? string.Empty
        : list.Count == 1
         ? $"{quoteWith}{list.Single()}{quoteWith}"
         : $"{string.Join(delimitWith ?? string.Empty, list.Take(list.Count - 1).Select(item => $"{quoteWith}{item}{quoteWith}"))}{delimitLastWith}{quoteWith}{list.Last()}{quoteWith}";
      }
    

    XUnit tests:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
      [Fact]
      public void JoinForHumansTest()
      {
       Assert.Equal("'a'", new List<string> {"a"}.ToHumanReadableString());
       Assert.Equal("''", new string[] { null }.ToHumanReadableString());
       Assert.Equal("'a'", new[] { "a" }.ToHumanReadableString());
       Assert.Equal("'a' or 'b'", new[] { "a", "b" }.ToHumanReadableString());
       Assert.Equal("'a' or ''", new[] { "a", null }.ToHumanReadableString());
       Assert.Equal("'a', 'b' or 'c'", new[] {"a", "b", "c"}.ToHumanReadableString());
       Assert.Equal("'a', 'b', 'c' or 'd'", new[] {"a", "b", "c", "d"}.ToHumanReadableString());
       Assert.Equal("'a';'b';'c' or 'd'", new[] {"a", "b", "c", "d"}.ToHumanReadableString(delimitWith: ";"));
       Assert.Equal("'a', 'b', 'c' and 'd'", new[] {"a", "b", "c", "d"}.ToHumanReadableString(delimitLastWith: " and "));
       Assert.Equal("a, b, c or d", new[] {"a", "b", "c", "d"}.ToHumanReadableString(string.Empty));
       Assert.Equal("abcd", new[] {"a", "b", "c", "d"}.ToHumanReadableString(null, null, null));
       Assert.Equal("", ((string[]) null).ToHumanReadableString(null, null, null));
      }
    

    Tuesday, 29 November 2016

    ReportMagic

    ReportMagic is a system for reporting on cloud IT monitoring systems.

    It primary purpose is to enhance and extend LogicMonitor, the awesome SaaS-based performance monitoring system from LogicMonitor Inc.   LogicMonitor provides not only near-real-time alerts on the state of your infrastructure, but also a huge wealth of historic information, and even forecasts the future on all measured data.

    Here are some headline features:

    Better LogicMonitor Dashboard Widgets

    ReportMagic widgets in a LogicMonitor Dashboard

    Because ReportMagic extends the default set of LogicMonitor dashboard widgets, it is now possible to include network diagrams in your LogicMonitor Dashboards.  What's more, any aspect of the diagram can show live alert status, including device groups, devices, links, ports etc.  Clicking on these items will take you to the relevant item in LogicMonitor.  ReportMagic can also provide unlimited widget layout, including highly branded tables, progress bars, even full multi-page PDF reports, all within your existing LogicMonitor dashboard.

    LogicMonitor Alert Analytics

    Alert analysis in Excel

    For most LogicMonitor users, the system is there to alert them when something goes wrong, and it does this brilliantly, with time-based escalation chains, SMS alerts, e-mail and even automated phone calls to wake you up when something really needs fixing at 3 a.m.

    However, few users make full use of the alert history.  ReportMagic permits multi-dimensional analysis of historic LogicMonitor alert data, all within familiar Microsoft Excel pivot tables. ReportMagic also permits analysis of LogicMonitor system logs in the same way.

    Branded customer reporting

    ReportMagic means that Managed Service Providers can finally produce highly-branded, customer-quality reports on LogicMonitor data.  Better still, because ReportMagic will bring in data from your Ticketing system (AutoTask, Atlassian Jira etc.) reports that are taking you days to create are now generated automatically, overnight and mailed directly to you and/or your customer in Word, PDF, Excel or HTML form.  Because these reports can be embedded in your LogicMonitor Dashboard, the latest version can be made available to your customer whenever they log in.

    Other features

    Other features include:

    • Device management (bulk import/export)
    • Collectors management (advanced debug, Groovy and PowerShell script development).
    • Netflow policy management
    • Audit reporting

    How does it work?

    ReportMagic interacts directly with LogicMonitor via the LogicMonitor REST API. and the LogicMonitor.Api nuget package for .NET, also authored by Panoramic Data.


    Sounds interesting - tell me more!

    If you are interested in ReportMagic, please do sign up at https://reportmagic.net/, contact me using the form or add me via Linked In.

    Best wishes,

    David