Using the acct utility

The acct utility allows you to see statistics of user activity in the system.

Installation in Ubuntu:

sudo apt-get install acct

Removed in Ubuntu with the following command:

sudo apt-get remove acct

Installation in Fedora:

su -c 'yum install psacct'

Running in Ubuntu:

/etc/init.d/acct start

Running in Fedora:

su -c 'service acct start'

I will list and describe several commands of the acct utility:
ac – statistics on the time spent by users in the system
ac -d (per day)
ac -y (in a year)
ac -p (individual statistics)
ac –version (display version of the utility)
man ac (help on the team)

sa – information about executed commands and running applications
sa -c (statistics in percent)
man sa (help on the command)

lastcomm – last executed commands
sudo accton on/off – on and off collection of information

Troubleshooting and Error 0x00000005 after Windows Update from 14.08.13

After installing the Windows updates from August 14, 2013 many users stopped running many applications with the output of the error 0x00000005 or even the operating system stopped loading. In particular, Windows 7 x64. The cause was the installation of the update KB2859537. To fix the error, you can remove it by typing the command:

wusa.exe /uninstall /kb:2859537

09/11/2013 one more update has been issued that causes the same symptoms, we also treat with the removal:

wusa.exe /uninstall /kb:2872339

SNMP OID List for iLO4

I made a template for Zabbix today to monitor iLO 4 on the HP DL380p G8 server and had to investigate several OIDs.

You can check the OID from Linux with the command:
snmpwalk 192.168.1.5 -c КОМЬЮНИТИ -v 2c OID

Below is a list and description for OID coolers, processors, temperature sensors, logical drives (RAID), hard disks, network controller iLO, RAM.

Fans:
.1.3.6.1.4.1.232.6.2.6.7.1.2.0 (Fan Index)
.1.3.6.1.4.1.232.6.2.6.7.1.3.0 (Fan Locale (1=other, 2=unknown, 3=system, 4=systemBoard, 5=ioBoard, 6=cpu, 7=memory, 8=storage, 9=removable media, 10=power supply, 11=ambent, 12=chassis, 13=bridge card, 14=management board, 15=backplane, 16=network slot, 17=blade slot, 18=virtual)
.1.3.6.1.4.1.232.6.2.6.7.1.4.0 (Fan Present (1=other, 2=absent, 3=present)
.1.3.6.1.4.1.232.6.2.6.7.1.5.0 (Fan Present (1=other, 2=tachOutput, 3=spinDetect)
.1.3.6.1.4.1.232.6.2.6.7.1.6.0 (Fan Speed (1=other, 2=normal, 3=high)
.1.3.6.1.4.1.232.6.2.6.7.1.9.0 (Fan Condition (1=other, 2=ok, 3=degraded, 4=failed)

Temperature:
.1.3.6.1.4.1.232.6.2.6.8.1.2.0 (Temperature Sensor Index)
.1.3.6.1.4.1.232.6.2.6.8.1.3.0 (Temperature Sensor Locale (1=other, 2=unknown, 3=system, 4=systemBoard, 5=ioBoard, 6=cpu, 7=memory, 8=storage, 9=removable media, 10=power supply, 11=ambent, 12=chassis, 13=bridge card)
.1.3.6.1.4.1.232.6.2.6.8.1.7.0 (Threshold Type (1=other, 5=blowout, 9=caution, 15=critical, 16=noreaction)
.1.3.6.1.4.1.232.6.2.6.8.1.4.0 (Temperature Celsius)
.1.3.6.1.4.1.232.6.2.6.8.1.5.0 (TemperatureThreshold)
.1.3.6.1.4.1.232.6.2.6.8.1.6.0 (TemperatureCondition)

CPU:
.1.3.6.1.4.1.232.1.2.2.1.1.1 (CPU Index)
.1.3.6.1.4.1.232.1.2.2.1.1.3 (CPU Name)
.1.3.6.1.4.1.232.1.2.2.1.1.4 (CPU Speed in MHz)
.1.3.6.1.4.1.232.1.2.2.1.1.5 (CPU Step)
.1.3.6.1.4.1.232.1.2.2.1.1.6 (CPU status (1=unknown, 2=ok, 3=degraded, 4=failed, 5=disabled)
.1.3.6.1.4.1.232.1.2.2.1.1.15 (Number of enabled CPU cores)
.1.3.6.1.4.1.232.1.2.2.1.1.25 (Number of available CPU threads)
.1.3.6.1.4.1.232.1.2.2.1.1.26 (CPU power status (1=unknown, 2=Low Powered, 3=Normal Powered, 4=High Powered)

Logical Drives:
.1.3.6.1.4.1.232.3.2.3.1.1.2.0 (Logical Drive Index)
.1.3.6.1.4.1.232.3.2.3.1.1.1.0 (Logical Drive Controller)
.1.3.6.1.4.1.232.3.2.3.1.1.3.0 (Logical Drive Fault Tolerance (1=other, 2=none, 3=RAID 1/RAID 1+0 (Mirroring), 4=RAID 4 (Data Guard), 5=RAID 5 (Distributed Data Guard), 7=RAID 6 (Advanced Data Guarding), 8=RAID 50, 9=RAID 60, 10=RAID 1 ADM (Advanced Data Mirroring), 11=RAID 10 ADM (Advanced Data Mirroring with Striping))
.1.3.6.1.4.1.232.3.2.3.1.1.9.0 (Logical Drive Size in Mb)
.1.3.6.1.4.1.232.3.2.3.1.1.4.0 (Logical Drive Status (1=other, 2=ok, 3=Failed, 4=Unconfigured, 5=Recovering, 6=Ready Rebuild, 7=Rebuilding, 8=Wrong Drive, 9=Bad Connect, 10=Overheating, 11=Shutdown, 12=Expanding, 13=Not Available, 14=Queued For Expansion, 15=Multi-path Access Degraded, 16=Erasing, 17=Predictive Spare Rebuild Ready, 18=Rapid Parity Initialization In Progress, 19=Rapid Parity Initialization Pending, 20=No Access – Encrypted with No Controller Key, 21=Unencrypted to Encrypted Transformation in Progress, 22=New Logical Drive Key Rekey in Progress, 23=No Access – Encrypted with Controller Encryption Not Enabled, 24=Unencrypted To Encrypted Transformation Not Started, 25=New Logical Drive Key Rekey Request Received)
.1.3.6.1.4.1.232.3.2.3.1.1.11.0 (Logical Drive Condition (1=other, 2=ok, 3=degraded, 4=failed)

Drives:
.1.3.6.1.4.1.232.3.2.5.1.1.2.0 (Drive Index)
.1.3.6.1.4.1.232.3.2.5.1.1.5.0 (Drive Bay)
.1.3.6.1.4.1.232.3.2.5.1.1.64.0 (Drive Location)
.1.3.6.1.4.1.232.3.2.5.1.1.3.0 (Drive Vendor)
.1.3.6.1.4.1.232.3.2.5.1.1.51.0 (Drive Serial Number)
.1.3.6.1.4.1.232.3.2.5.1.1.45.0 (Drive Size in Mb)
.1.3.6.1.4.1.232.3.2.5.1.1.65.0 (Drive Link Rate (1=other, 2=1.5Gbps, 3=3.0Gbps, 4=6.0Gbps, 5=12.0Gbps))
.1.3.6.1.4.1.232.3.2.5.1.1.70.0 (Drive Current Temperature)
.1.3.6.1.4.1.232.3.2.5.1.1.71.0 (Drive Temperature Threshold)
.1.3.6.1.4.1.232.3.2.5.1.1.72.0 (Drive Maximum Temperature)
.1.3.6.1.4.1.232.3.2.5.1.1.6.0 (Drive Status (1=Other, 2=Ok, 3=Failed, 4=Predictive Failure, 5=Erasing, 6=Erase Done, 7=Erase Queued, 8=SSD Wear Out, 9=Not Authenticated)
.1.3.6.1.4.1.232.3.2.5.1.1.37.0 (Drive Condition (1=other, 2=ok, 3=degraded, 4=failed)
.1.3.6.1.4.1.232.3.2.5.1.1.9.0 (Drive Reference Time in hours)

iLO NIC:
.1.3.6.1.4.1.232.9.2.5.2.1.1 (iLO location)
.1.3.6.1.4.1.232.9.2.5.1.1.2 (iLO NIC model)
.1.3.6.1.4.1.232.9.2.5.1.1.4 (iLO NIC MAC)
.1.3.6.1.4.1.232.9.2.5.1.1.5 (iLO NIC IPv4)
.1.3.6.1.4.1.232.9.2.5.1.1.9 (iLO NIC speed)
.1.3.6.1.4.1.232.9.2.5.1.1.14 (iLO NIC FQDN)
.1.3.6.1.4.1.232.9.2.5.2.1.2 (Tx bytes)
.1.3.6.1.4.1.232.9.2.5.2.1.3 (Tx packets)
.1.3.6.1.4.1.232.9.2.5.2.1.6 (Tx discard packets)
.1.3.6.1.4.1.232.9.2.5.2.1.7 (Tx error packets)
.1.3.6.1.4.1.232.9.2.5.2.1.9 (Rx bytes)
.1.3.6.1.4.1.232.9.2.5.2.1.10 (Rx packets)
.1.3.6.1.4.1.232.9.2.5.2.1.13 (Rx discard packets)
.1.3.6.1.4.1.232.9.2.5.2.1.14 (Rx error packets)
.1.3.6.1.4.1.232.9.2.5.2.1.15 (Rx unknown packets)

Memory:
.1.3.6.1.4.1.232.6.2.14.13.1.1 (Memory Index)
.1.3.6.1.4.1.232.6.2.14.13.1.13 (Location)
.1.3.6.1.4.1.232.6.2.14.13.1.9 (Manufacturer)
.1.3.6.1.4.1.232.6.2.14.13.1.10 (Part Number)
.1.3.6.1.4.1.232.6.2.14.13.1.6 (Size in Kbytes)
.1.3.6.1.4.1.232.6.2.14.13.1.8 (Memory Technology)
.1.3.6.1.4.1.232.6.2.14.13.1.7 (Memory Type)
.1.3.6.1.4.1.232.6.2.14.13.1.19 (Memory status (1=other, 2=notPresent, 3=present, 4=good, 5=add, 6=upgrade, 7=missing, 8=doesNotMatch, 9=notSupported, 10=badConfig, 11=degraded, 12=spare, 13=partial)
.1.3.6.1.4.1.232.6.2.14.13.1.20 (Memory condition (1=other, 2=ok, 3=degraded, 4=degradedModuleIndexUnknown)

How to remove W3 Total Cache plugin from WordPress

To uninstall W3 Total Cache from WordPress, you need:

1) In the plugin menu, click the cache clear button.

2) Deactivate the plugin in the plugins menu and click “Delete”

3) In the root directory of the site, at the beginning of the wp-config.php file, if left, delete the lines:

/** Enable W3 Total Cache Edge Mode */
define('W3TC_EDGE_MODE', true); // Added by W3 Total Cache

/** Enable W3 Total Cache */
define('WP_CACHE', true); // Added by W3 Total Cache

4) As I noticed after the plug-in there are a lot of files, and on large sites there can be millions of files with cached data.
In the wp-content directory, delete the files, if any, advanced-cache.php, object-cache.php, w3tc-config and cache (here cached data).

Done.

Disabling ecryptfs encryption at home directory

It took one day to disable the ecryptfs encryption of the home directory, which was once set up when installing the system.

First of all, we make a copy of the home directory of the right user:

sudo cp -rp /home/user /home/user_backup

Get the mount point in the directory:

PRIVATE=`cat ~/.ecryptfs/Private.mnt 2>/dev/null || echo $HOME/Private`

Unmount the directory:

ecryptfs-umount-private

Install the rights to the directory:

chmod 750 $PRIVATE

Delete the directory and directories ~/.Private, ~/.ecryptfs:

rm -rf $PRIVATE ~/.Private ~/.ecryptfs

And also in the made copy:

rm -rf /home/user_backup/.Private /home/user_backup/.ecryptfs

If ecryptfs is no longer used in the system, then we will delete the utilities:

sudo apt-get remove ecryptfs-utils libecryptfs0

Install the right user directory:

sudo chmod 750 /home/user
sudo chown user:user -R /home/user

Copy the necessary files from the backup copy of the home directory.

Done.

You can see the built-in statement with the command:

ecryptfs-setup-private --undo

See also:
The solution to the error “Could not chdir to home directory /home/user: Permission denied”

nice and ionice. Process Priorities

nice – allows you to specify the priority of the processor performing various tasks, the range of priorities is -20 to 19, where 19 is the smallest, if not specified, then there will be a standard priority of 0. Convenient for example when packing data into archives so that this task does not load the server or when many processes need to be started, distributing the load, which occupy all CPU time.

Example of the execution of the command with the lowest priority:

nice -n 19 COMMAND

See the table of processes and their priorities as follows (column NI):

ps axl
ps -l

If the table is large, you can redirect the output of the command to Less and look at the page:

ps axl | less

To change the priority:

renice -n 19 PROCESS(PID)

Checking the default priority value (standard 0):

nice

ionice – allows you to specify the priority for I/O operations, for example, to reduce the load on the disk. The first class is from 1 to 3, then the priority is from 0 to 7, where 7 is the smallest.
There are three classes:
1) Real time – Preemptive without paying attention to other processes, indicating priorities from 0 to 7.
2) Best Effort — Standard with priorities from 0 to 7.
3) Idle — With idle time without priority.

Example of executing the command with the lowest I/O priority:

ionice -c2 -n7 COMMAND

To change the priority:

ionice -c2 -n7 -p PROCESS(PID)

To view the set priority:

ionice -p PROCESS(PID)

You can specify priorities at the same time via nice and ionice:

nice -n 19 ionice -c2 -n7 COMMAND

To specify high priorities, for example, you might need root permissions, this command should be executed as root user or added before the sudo command.

Solving the SSL problem “Connection is not secure – Parts of this page are not secure (such as images)”

I noticed once one site with a signed SSL certificate, a message from the Mozilla Firefox browser:

Connection is not secure – Parts of this page are not secure (such as images)

As it turned out, images from other sources were inserted on the site, so the connection can be considered not protected, and to solve this problem, you need to upload images to the current site and change the link on the pages, necessarily starting with https://.

If the site works on http:// and https://, and the pictures are on it, then the links should be changed for example from:

<img src="http://www.ixnfo.com/img.jpg">

to

<img src="/img.jpg">

Done.

Configuring Protected Ports on Cisco

On the test, I will configure the Cisco Catalyst WS-C3750-48TS-S.

And so, all ports are configured as access, except for the first Gigabit uplink port, it is configured as a trunk and the Internet on the client vlan with the tag comes to it.
We need all the ports on this switch to not see each other and see only the first gigabit ulink port.

To do this, connect to the switch and go into the configuration mode:

enable
configure terminal

Then, we issue the switchport protected command for all access ports:

interface range fastEthernet 1/0/1-48
switchport protected
interface range gigabitEthernet 1/0/2-4
switchport protected
exit
exit

Save the configuration:

write

Apparently interface gigabitEthernet 1/0/1 we did not touch.
Now the ports on which the switchport protected command is registered do not see the other ports on which this command is also registered, they see only the ports where it is not registered, that is, in our case the first gigabit ulink port, and it sees all the ports with the command and without.

Information about ports can be viewed by the command:

show interfaces NAME switchport

View full configuration:

show running-config

See also:
Port isolation on Huawei switches
Port isolation on the ZyXEL MES-3528 switch