What is Telemetry in I.T.?

Question
In the context of computers, what is telemetry?

Answer
Telemetry in I.T. is the logged system data transmitted from other servers.

A more detailed definition of telemetry is the utilization of a centralized system to automatically ingest log data from other sources to enable one or more of the following: redundant storage of critical log data, monitoring, data visualization, anomaly detection, resource utilization for billing, performance diagnostics including root cause analysis of failures. This definition is based on our interpretation of The DevOps Handbook and the book OpenStack Operations Guide by Fifield et al.

The log data could be application metadata, operating system logs or container logs. The system or sources could be a server, a cluster of servers, a container or a group of containers. To meter the use of servers or measure quantifiable aggregates of data, telemetry provides logging and monitoring functionality.

Telemetry has its place for activities such as managing operating system packages, vulnerability auditing, and the cataloging of software versions.

What are Higher-level Resources and Constructs Compared to Lower-level Resources and Constructs?

Question
You have read about high/low level or higher-level (or lower-level) resources and constructs in the context of Kubernetes. What does this designation mean?

Answer
From a high level to a low level we may see a data center, filled with racks, which hold physical servers. Similarly from a high level to a low level we may see Kubernetes nodes supporting pods that have individual Docker containers. Deployments are considered to be at a higher level than ReplicaSets which are considered to be at a higher level than pods. See What is a deployment in Kubernetes?.

"A Deployment is a higher-level resource meant for deploying applications and updating them declaratively, instead of doing it through a ReplicationController or a ReplicaSet, which are both considered lower-level concepts." (Taken from page 261 of Kubernetes in Action.)

"Using a Deployment instead of the lower-level constructs makes updating an app much easier, because you’re defining the desired state through the single Deployment resource and letting Kubernetes take care of the rest…" (Taken from page 262 of Kubernetes in Action.)

"Because you’re not supposed to group multiple processes into a single container, it’s obvious you need another higher-level construct that will allow you to bind containers together and manage them as a single unit." (Taken from page 57 of Kubernetes in Action.)

The Deployment controller, to create a deployment resource and pods, changes the number of ReplicaSets via the API server. This causes the ReplicaSet controller to actually create pods. (To learn more, see page 331 of Kubernetes in Action.) The higher-level resource of a Deployment is created via the lower-level resource of the ReplicaSets.

In Datadog, there can be a dedicated dashboard for Kubernetes deployments. It can be quite meaningful and useful to a human professional to see a graph of CPU/RAM utilization; logically for resource utilization from a business perspective, a Datadog dashboard for Kubernetes deployments can be useful. (As an illstration, see this picture in the lower left-hand corner for an option to view resource consumption for Kubernetes deployments.) Conversely Nagios/Zabbix resource utilization monitoring of underlying servers has its value, but in some contexts a higher-level resource is conceptually applicable to certain optimization and cost-controlling efforts.


Higher-level resources in Kubernetes refer to smaller more basic elements comprising a more complex entity. Similar to this context, higher-order functions in Python refer to optional libraries that give a human the ability to interact with more sophisticated components. One example is the functools library that gives a Python coder more commands.

How Do You Upgrade to Python 3.x on Ubuntu 16?

Problem scenario
You are using Python 2.7.12 on Ubuntu 16. You want to upgrade to Python 3.x You are having problems. You tried several things as follows:
sudo apt-get -y install python 3.7
But you see this:

python is already the newest version (2.7.12-1~16.04).
python set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libgnuradio-fosphor3.7.0 : Depends: ocl-icd-libopencl1 (>= 1.0) but it is not going to be installed or
libopencl-1.1-1
E: Unable to correct problems, you have held broken packages.


sudo apt -y install libopencl-1.1-1

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting 'ocl-icd-libopencl1' instead of 'libopencl-1.1-1'
ocl-icd-libopencl1 is already the newest version (2.2.8-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo apt -y install ocl-icd-libopencl1

Reading package lists… Done
Building dependency tree
Reading state information… Done
ocl-icd-libopencl1 is already the newest version (2.2.8-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo apt -y install libgnuradio-fosphor3.7.0

Reading package lists… Done
Building dependency tree
Reading state information… Done
libgnuradio-fosphor3.7.0 is already the newest version (3.7.0.1.e1eb11b-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

You tried rebooting, updating and upgrading packages. Nothing seems to work. How do you upgrade to Python 3.x?

Solution
1. Try this command: whereis python3
You will likely find the binary in /usr/bin/.

2. Make a back up of the binary for python 2 (e.g., /usr/bin/python). You may want to do it like this: sudo mv /usr/bin/python /usr/bin/bakpythonbak

3. Move the file you found in step #1 to be where the file is that you backed up in step #2. You may want to do it like this: sudo mv /usr/bin/python3 /usr/bin/python

4. You are done. If you are still having problems, you may want to look at your /etc/apt/sources.list file. You may want to back it up before making changes too.

How Do You Troubleshoot “Error: Could Not Create the Java Virtual Machine”?

Problem scenario
You ran a Hadoop command but you receive this error:

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

What do you do?

Solution
Run hadoop help. This error can happen when you have an incorrect flag.

New Gadgets and Appliances Are Fun

Advertisement
Looking for a new TV?  Looking for a new refridgerator?  Looking for a new microwave?  Looking for a new air conditioner?  We find SpectreKenmoreRival, and GE to be good brands respectively. 

​Looking for a new space heater?  You may want to try e-Flame USA's interesting-to-watch space heater.

How Do You Write a Python Program to Accept Input in a Non-interactive Way at Run-time?

Problem scenario
You are used to using "input" with Python 3 to prompt the user for a value. How do you pass input when you execute a Python program?

Solution
1. Use import sys

2. Use sys.argv[1] to refer to the first argument passed when you run your program like this:

python3 goodprog.py foo

The program will see "sys.argv[1]" as the string "foo".

Here is another example: python3 goodprog.py bar

The program will see "sys.argv[1]" as the string foo. The program will see "sys.argv[2]" as the string bar.

How Do You Troubleshoot the ng Error “—–Mg: scratch (fundamental)—-All——————“?

Problem scenario
You run this command ng --version, but you receive a blank screen at the terminal like this:

-----Mg: scratch (fundamental)----All------------------

What do you do?

Solution

1. Use "ctrl-z" to exit out.

2. Run these commands:

sudo apt remove ng-common
sudo npm uninstall -g @angular/cli
sudo npm install -g @angular/cli

3. You are done.

How Do You Upgrade Python 2.x to Python 3.7 in Debian or Ubuntu Linux?

Problem scenario
You have a virtual server running Ubuntu 18.x in Azure. It has Python 2.x. How do you upgrade to Python 3.x?

Solution
1. Run these two commands:
sudo apt -y update
sudo apt -y install python 3.7

2. Find where the binary python3.7 is by running this: sudo find / -name python3.7
Make a mental note of the result. It should be something like /usr/bin/python3.7

3. Run this: which python

4. Back up the resulting file (e.g., sudo mv /usr/bin/python /usr/bin/bakpythonbak)

5. Draft a command like this, but substitute /usr/bin/python3.7 with the path found in step #2.

sudo ln -s /usr/bin/python3.7 /usr/bin/python

6. Run the command above from step #5.

7. Test it. Run this: python --version
Once Python is working to your satisfaction, you may want to delete /usr/bin/bakpythonbak.

You should now be done. If you want to upgrade Python on any distribution of Linux without using binaries (e.g., using source media), see this posting as a guide.

How Do You Write a Tic-Tac-Toe Program in Ruby?

Problem scenario
You want to write a Tic-Tac-Toe program in Ruby. What should you do?

Solution

# Tic-tac-toe game in Ruby. Written by continualintegration.com.
# We know Ruby is object-oriented.  Ideally we will re-write this to encapsulate all logic in objects.
puts "This is a two player game of tictactoe.  One person can pretend to be the other player."
puts "Both players should share a keyboard and monitor."
puts "The legend for squares in the grid is as follows: "
puts "                                                                "
puts "***************************************************************"
puts "ltc is left-top-corner, tm is top-middle, rtc is right-top-corner"
puts "lm is left-column-middle-row, c is center, mr is middlerow-right-column"
puts "lbc is left-bottom-corner, bm is bottom-middle, rbc is right-bottom-corner"
puts "***************************************************************"
puts "                                                                "
puts "Enter a cell based on the legend above."
board = Array[' ',' ',' ',' ',' ',' ',' ',' ',' ']
def markboard(pos, play, board)
    if pos == 'ltc' then
      if board[0] == ' ' then
        board[0] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'tm' then
      if board[1] == ' ' then
        board[1] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'rtc' then
     if board[2] == ' ' then
       board[2] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'lm' then
     if board[3] == ' ' then
       board[3] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'c' then
     if board[4] == ' ' then
       board[4] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'mr' then
     if board[5] == ' ' then
       board[5] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'lbc' then
     if board[6] == ' ' then
       board[6] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'bm' then
     if board[7] == ' ' then
       board[7] = play
      else
        puts "That square has already been marked. Please try again."
        maincontrol(play, board)
      end
    elsif pos == 'rbc' then
     if board[8] == ' ' then
       board[8] = play
     end
    end
    return board
end

def prompt(*args)
    print(" Please enter your mark in one position: ")
    pos = gets.chomp
    return pos
end

def boardprinter(board)
  puts "Here is how the board looks now:"
  puts "======="
  topl = "|" + board[0] + "|" + board[1] + "|" + board[2] + "|"
  puts(topl)
  midl = "|" + board[3] + "|" + board[4] + "|" + board[5] + "|"
  puts(midl)
  botl = "|" + board[6] + "|" + board[7] + "|" + board[8] + "|"
  puts(botl)
  puts "======="
  puts " "
end


def legendprinter(counter)
  if counter == 3 then
    puts "***************************************************************"
    puts "ltc is left-top-corner, tm is top-middle, rtc is right-top-corner"
    puts "lm is left-column-middle-row, c is center, mr is middlerow-right-column"
    puts "lbc is left-bottom-corner, bm is bottom-middle, rbc is right-bottom-corner"
    puts "***************************************************************"
  elsif counter == 6 then
    puts "***************************************************************"
    puts "ltc is left-top-corner, tm is top-middle, rtc is right-top-corner"
    puts "lm is left-column-middle-row, c is center, mr is middlerow-right-column"
    puts "lbc is left-bottom-corner, bm is bottom-middle, rbc is right-bottom-corner"
    puts "***************************************************************"
  end
end


def boardcatchecker(board, flag)
    if board[0] != ' ' then
      if board[1] != ' ' then
        if board[2] != ' ' then
          if board[3] != ' ' then
            if board[4] != ' ' then
              if board[5] != ' ' then
                if board[6] != ' ' then
                  if board[7] != ' ' then
                    if board[8] != ' ' then
                      puts "Game over."
                      abort("Cat's game. It was a draw!")
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
end

def boardwinchecker(board)
  if board[0] == board[4] then # check the diagonal from left top to right bottom corner
    if board[4] == board[8] then
      if board[4] != ' ' then
        lastmessage = "Player " + board[0] + " wins!"
        abort(lastmessage)
      end
    end
  end
  if board[2] == board[4] then # check the diagonal from right top to left bottom corner
    if board[4] == board[6] then
      if board[6] != ' ' then
        lastmessage = "Player " + board[2] + " wins!"
        abort(lastmessage)
      end
    end
  end
  if board[0] == board[3] then # check the left column
    if board[3] == board[6] then
      if board[6] != ' ' then
        lastmessage = "Player " + board[0] + " wins!"
        abort(lastmessage)
      end
    end
  end
  if board[0] == board[1] then # check the top row
    if board[1] == board[2] then
      if board[0] != ' ' then
        lastmessage = "Player " + board[0] + " wins!"
        abort(lastmessage)
      end
    end
  end
  if board[2] == board[5] then # check right column
    if board[5] == board[8] then
      if board[2] != ' ' then
        lastmessage = "Player " + board[2] + " wins!"
        abort(lastmessage)
      end
    end
  end
  if board[6] == board[7] then # check bottom row
    if board[7] == board[8] then
      if board[8] != ' ' then
        lastmessage = "Player " + board[6] + " wins!"
        abort(lastmessage)
      end
    end
  end
  if board[1] == board[4] then # check middle column
    if board[4] == board[7] then
      if board[1] != ' ' then
        lastmessage = "Player " + board[1] + " wins!"
        abort(lastmessage)
      end
    end
  end
  if board[3] == board[4] then # check middle row
    if board[4] == board[5] then
      if board[3] != ' ' then
        lastmessage = "Player " + board[3] + " wins!"
        abort(lastmessage)
      end
    end
  end
end

def maincontrol(player, board)
  pos = prompt
  board = markboard(pos, player, board)
end


flag = "play"
counter = 0
player="X"
# As of 9/4/19 this while loop is for the counter and alternating the X and O users.
while flag == "play" do
  counter = counter + 1
  mes = player + ", it is your turn."
  print(mes)
  pos = prompt
  board = markboard(pos, player, board)
  boardprinter(board)
  if player == 'X' then
    player = "O"
  else
    player = "X"
  end
  legendprinter(counter) # This will only print once or twice per game.
  boardwinchecker(board) # This will look for a player to win or lose.
  boardcatchecker(board, flag) # This will test if it is a Cat's game or not.
end

What is a Service in Kubernetes?

Question
A Kubernetes cluster will have a pod running on a node. The ReplicationController will create a copy (or copies) of a pod to ensure it is available. What is a service in the context of a Kubernetes cluster?

Answer
"A Service in Kubernetes is an abstraction which defines a logical set of Pods and a policy by which to access them." This quote was taken from https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/

A service is a networking service with a static IP address that connects requests to pods in the Kubernetes cluster (page 48 of Kubernetes in Action by Luksa). A service's IP address does not change (page 48 of Kubernetes in Action).

You can use the kubectl expose command to create a service. To read more, see this posting.