Thursday, 17 December 2020

Dear Santa Pune,

I have been a good boy this year.

For Christmas 2021, I would like:

  • Custom Properties on all entities (including ability to filter via the REST API) so that System Integration is actually possible.
  • V3 of the REST API published, and under SEMVER
  • The broken Alerting API to be fixed (see various other FEED tickets)
  • The UI to finally be self-consistent (either back with the old style or with the new style - I really don't care)
  • To receive a reference number when I send a support/feedback ticket and to be able to track its progress via the UI
  • Themes / Dark Mode
  • A machine-readable Audit Log for ALL Create/Update/Delete actions with a published, consistent JSON schema

I hope you are able to deliver all the releases to the good boys and girls.

Happy Christmas,

David

p.s. Also:

  • A last_updated field on all entities

Wednesday, 9 December 2020

Getting Remote Explorer to work in VS Code

 Follow the instructions in this post:

https://github.com/PowerShell/Win32-OpenSSH/issues/1263#issuecomment-699148072

Friday, 6 November 2020

LogicMonitor LMGlobalData

 To view additional information about your LogicMonitor account, press F12 in Chrome, go to the Console and type:

LMGlobalData

Tuesday, 22 September 2020

Timing cURL

This article ALMOST provides the information needed to add timing output to your cURL query:

Unfortunately, it gets the file format wrong.

Instead, the file should contain the following:

time_namelookup: %{time_namelookup}\n time_connect: %{time_connect}\n time_appconnect: %{time_appconnect}\n time_pretransfer: %{time_pretransfer}\n time_redirect: %{time_redirect}\n time_starttransfer: %{time_starttransfer}\n ———\n time_total: %{time_total}\n
curl -w "@curl-format.txt" -o /dev/null -s http://wordpress.com/

What this does:

  • -w "@curl-format.txt" tells cURL to use our format file
  • -o /dev/null redirects the output of the request to /dev/null
  • -s tells cURL not to show a progress meter
  • http://wordpress.com/ is the URL we are requesting

Tuesday, 23 June 2020

Lets Encrypt certificates for devices on private networks

Here's the process for creating a Let's Encrypt C.509 certificate for devices on private networks:

You will need:
  • Access to your DNS server to create TXT DNS records
  • Windows machine
  • PuttyGen installed
  • choco installed
  • win-acme installed with:
    • choco -y install win-acme
  • openssh installed with:
    • choco -y install openssh
  1. Create two identical files called create.bat and delete.bat with the following contents:
    • echo %1 %2 %3
  2. Create another file called sign.bat with the following contents:
    1. wacs --target csr --csrfile .\csr.txt --pkfile .\rsa4096.private.key --validationmode dns-01 --validation script --dnscreatescript .\create.bat --dnsdeletescript .\delete.bat --store pemfiles --pemfilespath .
  3. Generate an RSA 4096 Private key using PuTTYGen or OpenSSH called rsa4096.private.key
  4. Run the batch file
  5. While the ACME script is retrying, manually create the TXT DNS record for _acme-<DOMAIN NAME> with the value provided in the script output/
  6. If needs be, while the script is retrying, flush the DNS cache with:
    • ipconfig /flushdns
  7. Delete the TXT record when done
  8. The PEM file ending .crt.pem contains your X.509 certificate.

Thursday, 30 April 2020

Zaphod Beeblebrox

"The president’s job - and if someone sufficiently vain and stupid is picked he won’t realise this - is not to wield power, but to draw attention away from it. Zaphod Beeblebrox, the only man in history to have made presidential telecasts from the bath, from Eccentrica Gallumbits bedroom, from the maximum-security wing of the Betelgeuse State Prison, or from where ever else he happened to be at the time, was supremely good at this job."

Sound familiar?

Wednesday, 1 April 2020

Installing a LogicMonitor collector on Centos 8


Struggling to install a LogicMonitor Collector on Centos 8?  I was too...

  • sudo su - # Become root – required by the bootstrap/installer
  • dnf -y install perl vim # Install perl and vim – BOTH are pre-requisites on Centos 8
  • ./LogicmonitorBootstrap64_100.bin # (Re)install the LM Collector
  • reboot # Reboot

Saturday, 7 March 2020

Minecraft server on Centos 8

Introduction

This document guides you through setting up a Minecraft server on Centos 8.  After installing Centos, get some basic packages:

sudo dnf -y install java-latest-openjdk.x86_64 wget vim nano screen

Add a minecraft user for the service to run as:

sudo useradd minecraft

Don't set a password - this user should not be able to log in

Change to the user:

sudo su - minecraft

Download the server from https://minecraft.net/en-us/download/server :

wget -c https://minecraft.net/en-us/download/server

This file will appear as minecraft_server.jar, so rename it (changing the version to the ACTUAL version):

mv server.jar minecraft_server_1.15.2.jar

Create a symbolic link.  This will make the service easier to maintain when you up/downgrade Minecraft.

ln -s minecraft_server_1.15.2.jar minecraft_server.jar

Whitelist players

If you want to restrict who can join your server, you will need their player IDs and their UUIDs.  The UUID can be found here: https://mcuuid.net/

Create a file: whitelist.json.  The contents should look like this:

[
  {
    "uuid": "abcdef12-3456-7891-2345-67890abcdef1",
    "name": "Player1Name"
  },
  {
    "uuid": "abcdef12-3456-7891-2345-67890abcdef2",
    "name": "Player2Name"
  },
  {
    "uuid": "abcdef12-3456-7891-2345-67890abcdef3",
    "name": "Player3Name"
  },
  {
    "uuid": "abcdef12-3456-7891-2345-67890abcdef4",
    "name": "Player4Name"
  }
]

OPs

Similarly, add a list of players that you want to be OPs on the server by creating ops.json.

[
  {
    "uuid": "abcdef12-3456-7891-2345-67890abcdef1",
    "name": "Player1Name",
    "level": 4,
    "bypassesPlayerLimit": false
  },
  {
    "uuid": "abcdef12-3456-7891-2345-67890abcdef2",
    "name": "Player2Name",
    "level": 4,
    "bypassesPlayerLimit": false
  }
]

Copy an old world

Optionally, and before starting your Minecraft server, you may wish to copy an old world to a world folder in the same directory.

Test you can run at the command line

Run the server using:

java -Xmx4096M -Xms2048M -XX:ParallelGCThreads=1 -jar minecraft_server.jar nogui

Ensure you have the settings right - correct any issues that you discover.  One will probably be that you will need to edit eula.txt, changing false to true

vim eula.txt

Keep correcting any issues until you can run Minecraft.

To make sure that all is well with firewall rules etc, start the Minecraft game on your Laptop/desktop choose multiplayer and connect to the IP address of your server.

Now that the difficult bit is done, let's make sure the Minecraft server will start when the Linux server starts.

Add the Minecraft service

Create a new service unit file at /etc/systemd/system/sample.service with below content:

sudo vim /etc/systemd/system/minecraft.service

and paste the content:

[Unit]
Description=Minecraft Server
After=syslog.target network.target

[Service]
Type=simple
User=minecraft
Group=minecraft
WorkingDirectory=/home/minecraft
ExecStart=/bin/java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
Restart=on-failure

[Install]
WantedBy=multi-user.target

1. Reload the systemd process to consider newly created minecraft.service OR every time when minecraft.service gets modified.

sudo systemctl daemon-reload

2. Enable this service to start after reboot automatically.

sudo systemctl enable minecraft.service

3. Start the service.

sudo systemctl start minecraft.service

4. Reboot the host to verify whether the scripts are starting as expected during system boot.

sudo systemctl reboot

Test it's all working

After rebooting, you and your friends should be able to connect to the server.

Happy Crafting!

Sunday, 1 March 2020

.NET Core development on a Raspberry Pi 4

Introduction

These are start-to-finish instructions for creating and operating a Blazor application on a Raspberry Pi 4.  I have the 4GB model, but that is not too relevant - any memory size should be fine.

You will need

  • A Raspberry Pi 4
  • An SDXC card (I'm using 64GB, but 16GB or more should be fine)
  • A laptop (instructions here are for a Windows 10 Laptop)
  • An Internet connection

Install the operating system



  1. Download the following:
    1. Raspbian from here: https://www.raspberrypi.org/downloads/
    2. BalenaEtcher from here: https://www.balena.io/etcher/
  2. Run BalenaEtcher and select the .IMG or .ZIP file to install.

Connecting the hardware

Attach:

  • A USB keyboard
  • A USB mouse
  • HDMI cable to your TV/Monitor (you will need a special cable for this)
  • Insert the SDXC card into the Pi.  The slot is on the opposite side and at the opposite end of the board to the USB connectors
  • A USB-C power supply

Booting

When the Raspberry Pi has power connected, you should see the system "booting" on the TV/monitor.

Security configuration

The first thing you should do on any new installation is to change the default security settings.  The default username/password is pi/raspberry.  You should change this and note that somewhere safe.  

passwd pi

Enter the new password when prompted.

You should also add your own user.  I did this with:

sudo adduser david.bond

(this makes you add some details - provide these)

If the user is a system administrator (you will be, other family members may not be!)  run the same command with sudo on the end:

sudo adduser david.bond sudo

Now add users for other family members using the same commands.

You may wish to set up private and public keys, thought that is beyond the scope of this article.

Setting up SSH

Once the boot is complete, you may wish to add SSH access so that you can use your regular PC/laptop screen and keyboard, instead of always having the Raspberry Pi connected to the TV/monitor.

To enable SSH, follow instructions here:
Once you have added SSH access, we will set the IP address to a static one.  Before you do this, check your router for an IP address NOT in the DCHP range.  For example, if your router uses the range 192.168.1.100-192.168.1.200, you might (like me) choose to use 192.168.1.14.  To double check that nothing else is using it, ping it:

ping 192.168.1.14

Remember, you DON'T want anything to respond on that address.  If there is no response, you should see a number of messages containing "Destination host unreachable".

To set up the Pi to use your selected address, edit the file /etc/dchpcd.conf and uncommenting and editing the lines that look like this:

# Example static IP configuration:
interface wlan0
static ip_address=192.168.1.14/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.254
static domain_name_servers=192.168.1.254 8.8.8.8

You can leave the IPv6 line commented out with the # symbol.

In this example, my private subnet is 192.168.1.0/24, my gateway (which also serves as a DNS server) is on 192.168.1.254, I am allocating a static IP address of 192.168.1.14 and I am using Google (8.8.8.8) as a backup DNS server.

Set up Remote Desktop access

You may be fortunate enough to have a spare TV hanging around, in which case you can carry on all remaining steps using that.  If someone else wants to use the TV, you can do the rest from your laptop.  To do so, you will need to enable the Remote Desktop Protocol, by installing xrdp.
This website explains how to do this:
However, it just comes down to running the following command:

sudo apt-get install xrdp

Once this is done, you can use your Windows 10 laptop and run "Remote Desktop Connection" and connect to the static IP address you chose earlier.  Remember, you changed the default

Setting up the development environment

As we will be programming in C#, we will need .NET Core for ARM32 (the Raspberry Pi's processor) and an IDE (we will be using Visual Studio Code).

Install .NET Core

Firstly, go get the ARM32 files for .NET Core.  At the time of writing, the lastest version is 3.1.102, and the files are available here:
...however, you should install the latest version.

The easiest way to do that is to determine the correct URLs from the page above, then execute command like the following:
    wget https://download.visualstudio.microsoft.com/download/pr/349f13f0-400e-476c-ba10-fe284b35b932/44a5863469051c5cf103129f1423ddb8/dotnet-sdk-3.1.102-linux-arm.tar.gz
      wget https://download.visualstudio.microsoft.com/download/pr/8ccacf09-e5eb-481b-a407-2398b08ac6ac/1cef921566cb9d1ca8c742c9c26a521c/aspnetcore-runtime-3.1.2-linux-arm.tar.gz
      You can then install them as follows (check version numbers match what you have downloaded):

      mkdir dotnet-arm32
      tar zxf dotnet-sdk-3.1.102-linux-arm.tar.gz -C dotnet-arm32
      tar zxf aspnetcore-runtime-3.1.2-linux-arm.tar.gz -C dotnet-arm32


      Note that this results in the SDK and ASP.NET Core runtimes being available for you only, not other users.

      Install Visual Studio Code

      Headmelted provides a version of Visual Studio code for the Raspberry Pi.

      Check the contents of, then run the following:

      . <( wget -O - https://code.headmelted.com/installers/apt.sh )

      Once complete, you should be able to run Code using:

      code-oss


      Thursday, 13 February 2020

      Gearing up for LogicMonitor Level Up 2020

      Very much looking forward to LogicMonitor Level Up 2020 this year.

      We will be presenting our two flagship products: ReportMagic and ConnectMagic for LogicMonitor Reporting and System Integration.

      ReportMagic

      For the MSP with a strong brand and monthly reporting requirements, ReportMagic automatically provides detailed reports on LogicMonitor performance and availability data, together with Inventory, Ticketing and even finance data from your Issue, Inventory and Financial systems.

      ConnectMagic

      For the MSP or Enterprise with LogicMonitor System Integration requirements, ConnectMagic continually keeps all of your systems in sync.  No more data quality issues between systems.

      Both systems support:

      • LogicMonitor
      • ServiceNow
      • AutoTask
      • SalesForce
      • SQL Databases
      • ...and many more
      I hope to see you there!  We will have a stand, so please do come say hello, and maybe even stay for a demo.