How Do You Troubleshoot SonarQube Not Starting up Properly?

Problem scenario
SonarQube is not starting up properly. What should you do?

Possible Solution #1
For the sonar.properties file do not put "#" symbols on lines that are not completely commented out. They can cause you problems.

Possible Solution #2
You may want to click here to see more about re-installing it or troubleshooting the error.

Possible Solution #3
You may want to purchase a book on SonarQube, but we cannot guarantee these books necessarily will help you with SonarQube not starting up properly.
Sonar Code Quality Testing Essentials
SonarQube in Action
SonarQube Toolkit: best-practice templates, step-by-step work plans and maturity diagnostics

What Does SLS Stand for?

Question
You often see the initialism SLS. What does it stand for?

Answers
SLS disambiguation

1. Salt State System. SaltStack uses .sls files. "The core of the Salt State system is the SLS, or SaLt State file." (This quote was taken from this site.)

2. Scheduler Load Simulator (as in YARN SLS). To read more about this, try this website.

3. Softlanding Linux System

4. Spacelab Life Sciences

5. Service Level Specification

6. It is an alias for select-string in PowerShell.

7. It can stand for scalable login sequence.

8. Outside of I.T. SLS can stand for service, luxury, and style.

How Do You Troubleshoot an External Monitor That Does Not Work and You Cannot See Any Reference to It in the Windows Control Panel?

Problem scenario
With an HDMI cable you cannot get an external monitor that is connected to your Windows computer to work. In the Control Panel section for "Screen Resolution" there is a drop down menu for "Display." This will give some descriptive identification of your monitor when the monitor is working properly. It does not show an attached monitor. What should you do if the "Display" drop down in Screen Resolution (in the Windows Control Panel) does not show your monitor and the external monitor is not working to display any output?

Possible solution #1
Can you test the monitor and cable with another computer? The cable could be bad.

Possible solution #2
Assuming the monitor and cable work, open File Explorer and browse to "This PC". Right click "This PC" and go to "Manage". Go to Computer Management -> System Tools -> Device Manager -> Display Adapters. Double click the item underneath "Display Adapters" (e.g., "Intel HD Graphics). Go to the "Drivers" tab. Click "Rollback Driver". If "Rollback Driver" is grayed out, try "Update Driver" -- even if you have no access to a network or the internet. Changing the driver here can enable the external monitor to work.

Possible solution #3
If you need a new monitor, you can purchase one here.

How Do You Send an Email from the Command Prompt of Linux to a Long List of Recipients?

Problem scenarios
One or both of the following apply:

#1 You want to automate the sending of the exact same email to multiple people. You do not want to manually type in the recipients. You have the same subject and body that each recipient should receive. You want to customize the "from address" that the recipients see. How do you do this?

OR

#2 You are using the mail command on a Linux server. You want to customize the "from" address in the emails that you send. What do you do?

Solution
Prerequisites
You have installed mailx. If you are using a Red Hat derivative (e.g., CentOS/RHEL/Fedora), run this command: sudo yum -y install mailx

Solution
1. Create a file called list.csv. In it, put your email addresses inside. They should be separated by a comma. A space can be after the comma, but need not be.
2. Draft then use a command like this:

echo "payLoad of Message" | mail -s "placeSubjectHere" -r email@from.com $(cat list.csv)

-replace "payload of Message" with the message you want to send
-replace "placeSubjectHere" with the subject of your email
-replace "email@from.com" with the email address that you want the email to appear to be from

An Alternative Way To Send Email
Another way to do this is with Python; to learn how to use Python and not install anything else, see this external posting.

How Do You Programmatically Search Hyperlinks on a Given Webpage?

Problem scenario
You have a web page that you access from the front-end (e.g., a web browser). You want to see if there is a hyperlink on the page that goes to a certain URL. You know the web page and the URL, but you are not sure if a hyperlink on the website has such a link. What should you do?

Solution
Use the curl command. From a Linux command prompt, type this:

# Replace <URL of web page> with the web page you that has hyperlinks
# Replace "stringYouSearch" with an all-lowercase pattern that the hyperlink you are searching for
curl http://<URL of web page> | grep -i stringYouSearch

How Do You Troubleshoot the Puppet Error “file mode specification must be a string, not ‘Integer'”?

Problem scenario
You are running a manifest and you get this error:

Error: Failed to apply catalog: Parameter mode failed on File[/opt/hadoop/hadoop-2.2.0.tar.gz]: The file mode specification must be a string, not 'Integer' at /etc/puppetlabs/code/environments/production/modules/hadoop/manifests/init.pp:55

What is wrong?

Solution
Go to the Puppet Master server and open the file in the error. (The error provides the full directory path.) Go to the line number that the error message specifies. Find a file {} block section that looks something like this:

file { "${hadoop::params::hadoop_base}/hadoop-${hadoop::params::version}.tar.gz":
         mode => 0664,
         ensure => present,
         owner => "${hadoop::params::hadoop_path_owner}",
         group => "${hadoop::params::hadoop_group}",
         alias => "hadoop-source-tgz",
         before => Exec["untar-hadoop"],
         require => [File["hadoop-base"], Exec["download-hadoop"]],
     }

Translate the mode from octal notation to symbolic notation. If you do not know how, go to this website.

Enter the number in the website form and click "Submit." Change the Puppet manifest accordingly. In this example, the 'mode => 0664' line will need to be changed to 'mode => "u=rw,g=rw,o=r"'.

The website will show columns for user, group and other. These correspond to u, g, and o. The equals sign "=" assigns different permissions such as read, write or execute. Those permissions are symbolized with "r", "w", and "x" respectively.

How Do You Create a Puppet Manifest to Install Java?

Problem scenario
You have Puppet agent and Puppet Master set up and configured to work together. You are are running open source Puppet 5.x on Ubuntu servers in AWS. You want to install Java on the Puppet agent nodes. You tried to use the Java module.

On the Puppet Master server, you ran this: puppet module install puppetlabs-java --version 2.2.0

This is your site.pp file:

class { 'java' :
   package => 'java-1.8.0-openjdk-devel',
 }

You ran this command sudo puppet apply site.pp on the Puppet master but you got this:

Error: Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class puppetlabs-java at /etc/puppetlabs/code/environments/production/manifests/site.pp:11:1 on node

On the Puppet agent node you ran sudo /opt/puppetlabs/bin/puppet agent -t -d and you received this message:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class java at /etc/puppetlabs/code/environments/production/manifests/site.pp:11:1 on node ip-172-31-11-23.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

How do you create a manifest to deploy Java?

Solution
Install the Puppet module with the sudo command. If you do not use sudo, it will seem to work. But the 500 error with the Puppet agent is a tell-tale sign of using the Puppet module command without sudo. The inability to find the declared class on the Puppet Master server is another example of having installed a Puppet module without using the sudo command.

Finally the manifest should be changed to this:

class { 'java':
   distribution => 'jre',
 }

Run java -version to find that openjdk version 1.8 has been installed.

How Do You Capture More Events in the Nginx Logs?

Problem scenario
You want more verbose log capturing in Nginx. What should you do?

Solution
1. Make a back up of nginx.conf. Then open it. It is often in /etc/nginx/nginx.conf. (Some versions of nginx have a file that does some of the same things called default.conf. This will be the file you will need if you have no nginx.conf file.)

2. Find this stanza:

error_log /var/log/nginx/error.log;

Change it to be like this:

error_log /var/log/nginx/error.log debug;

3. Restart nginx. The error.log will have much more information. If you stop the Nginx service, this will be logged in error.log. You will also see malloc calls (memory allocation calls) and other vestiges of the C language. (Nginx was written in C.) This information can help you troubleshoot.

How Do You Troubleshoot Puppet Agent with a “Failed to open TCP connection…connection refused port 8140” error?

Problem scenario
You run puppet agent but you get this error:

Error: Could not request certificate: Failed to open TCP connection to puppetmaster.domain.com:8140 (Connection refused - connect(2) for "puppetmaster.domain.com" port 8140)

What do you do?

Solution
Ensure port 8140 is open. Install nmap on a server, and run this command:

nmap -p 8140 puppetmaster.domain.com

If you see this

PORT STATE SERVICE
8140/tcp closed unknown

Then the Puppet Master service is not running. Start the puppet master service (e.g., sudo puppet master start). If you need help installing Puppet Master, see this link for Ubuntu and this link for RedHat.

If you get a message showing that port 8140 is filtered, change the Security Group (in AWS), the Network Security Group (in Azure) or the firewall between the two servers.

How Do You Troubleshoot the Puppet Problem “Error 500 on SERVER: … Could not find node statement with name ‘default’ or “?

Problem scenario
You run the Puppet agent on a server but you receive this error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find node statement with name 'default' or 'ip-172-31-20-105.us-east-2.compute.internal, ip-172-31-20-105.us-east-2.compute, ip-172-31-20-105.us-east-2, ip-172-31-20-105' on node ip-172-31-20-105.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

What should you do?

Solution
Is your Puppet manifest using a regex? For example, if your manifest is supposed to use wildcard variables and match the FQDN of the Puppet Agent node that gives this error, the variables do not seem to be matching up. Try to re-write the manifest so there is a "default" or explicit FQDN of the Puppet Agent. Then this error will go away.