Enable SNMP php 7 Ubuntu

Before you enable SNMP in PHP 7, you first need to make sure that you have the proper SNMP packages installed on the Ubuntu System.

Install the SNMP packages

sudo apt-get install snmpd snmp libsnmp-dev

Before you install the PHP package, make sure you download and install the following package:

apt-get install snmp-mibs-downloader

This package will help translate OIDs into human readable strings

Now you can install the php extension.

apt-get install php-snmp

Then restart the followings:

service snmpd restart
service apache2 restart
or
Service nginx restart

Reference
Install and Manage MIBS file
https://packages.ubuntu.com/xenial/net/snmp-mibs-downloader

Linux Command: Tee

“The tee command is normally used to split the output of a program so that it can be both displayed and saved in a file.” wikipedia

tee file.txt

This command create a file.txt and anything you type is : displayed on the screen AND written to the file.

ctrl + z or ctrl + c 

Use this command above to end the session

tee -a file.txt

Same thing as the previous command, except this time it is using the -a (append) flag.

“Note: When tee is used with a pipe, the output of the previous command is written to a temporary file. When that command finishes, tee reads the temporary file, displays the output, and writes it to the file(s) given as command-line argument.” wikipedia

echo "We are YCSoftware" | tee -a file.txt 

The output of the echo command to be written to the file file.txt AND also displayed it on the screen

Reference
https://en.wikipedia.org/wiki/Tee_(command)

print_req_error: I/0 error, dev fd0, sector 0

Step 1

let’s list the block devices

lsblk

if you are not using any floppy disk, there is no reason to have fd0 listed in the output of the command above.

Step 2

rmmod floppy

“rmmod is a simple program which removes (unloads) a module from the Linux kernel.” Now run step 1 again to verify that the fd0 is no longer listed.

Step 3

Run the following command to make the changes permanent

echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf

This command just create a file name blacklist-floppy.conf in the /etc/modprobe.d folder and appends the text “blacklist floppy” to it.

Step 4

The last step is to reconfigure the kernel

dpkg-reconfigure initramfs-tools

Letsencrypt certbot auto renew not working (Debian, Ubuntu) systemd

If your letsencrypt SSL certificates are not renewed automatically, chances are that your certbot.timer service is not running.

Here are the steps to troubleshoot this issue:

1. List all current systemd timers
(see if Certbot is listed, chances are it is not listed)

systemctl list-timers --all

2. Verify that these files exist:

/lib/systemd/system/certbot.service
/lib/systemd/system/certbot.timer
/etc/cron.d/certbot

Note that there is no need to create a separate cron jon to trigger the renawal if these files exist.

3.Start the Certbot Timer
If the files above exist then run the following command to start the timer service

systemctl start certbot.timer

4.Enable the Timer on BOOT
Now enable the timer service on boot

systemctl enable certbot.timer

5.Verify
List all the timers again to verify that certbot is running

systemctl list-timers --all