Latest "Diagnostics" files
Workshop » Reference Section » Grimoires » IT » Applications » Web Browsers » CSS

Determining which javascript script changed an element’s attribute

Determining which script changed an element's attribute

So, I had an issue where quite a while ago I added some js code that would open a [code]details[/code] disclosure element if it contained a named anchor that was included in the page's URL. For instance if you loaded the URL [code]https://thisdomain.com/somepage.html#blahblahblah[/code], and the page had [code][/code] hidden inside a closed [code]details[/code] element, it would open that element by setting the attribute "open" on the details element, and scroll to reveal the anchor.

The problem was, I needed to make some changes to how that code functioned, and I couldn't find where I had added the script that did that.

Long story short: I temporarily added this script to the head of the page, and then reloaded it with an #anchor added to the URL, in this case [code]https://michaelkupietz.com/literally-hundreds-capsule-reviews/#puzzlehead[/code]:

[code] // Override the open property setter to catch when…
Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » PHP

How to monitor RAM for tuning pm.max_children

How to monitor RAM usage:

  1. free -h:

    • This command shows your system's total, used, and free memory in a human-readable format.
    • Key metrics:
      • total: Total RAM.
      • used: RAM currently in use.
      • free: Unused RAM.
      • buff/cache: RAM used for file system buffers and page cache. This is good; Linux uses free RAM for this and frees it when applications need it.
      • available: The most important metric. This estimates how much memory is available for starting new applications without swapping.
    • Run it before and after: Run free -h before you increase max_children and then after your server has been running for a while under typical load with the new settings. Compare the available memory.
  2. htop (recommended if installed):

    • htop (you might need to sudo…
Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » cron

Add sar logging for CPU, RAM, and disk I/O

Add or change /etc/cron.d/sysstat to this. This creates a cron jobe to write file /tmp/outage_resource_log.txt that keeps minute-by-minute stats, sometimes useful in troubleshooting slowdowns. However, it's not a great way to do things, it create a small, constant resource drag, so disable it when done troubleshooting.

# The first element of the path is a directory where the debian-sa1
# script is located
PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin

# Activity reports every 10 minutes everyday
#ORIGINAL DEFAULT WAS 5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
#uncomment above line and comment out /tmp/outage_resource_log.txt lines to restore original functionality
* * * * * root date +"%Y-%m-%d %H:%M:%S" >> /tmp/outage_resource_log.txt
* * * * * root sar -u 1 1 >> /tmp/outage_resource_log.txt 2>&1
* * * * * root sar -r 1 1 >> /tmp/outage_resource_log.txt 2>&1
* * *…

Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » Apache

Add /fpm-status page to Apache virtual host

Add this to virtual host file in /etc/apache2/sites-available/, right below DocumentRoot, in both :80 and :443 sections



SetHandler "proxy:unix:/var/php-fpm/170027027353667.sock|fcgi://127.0.0.1"
Require all granted

May need in /etc/php/8.2/fpm/pool.d/www.conf, not sure:
pm.status_path = /fpm-status

May need at very start of .htaccess to prevent wordpress from intercepting the URL, not sure:
RewriteRule ^fpm-status$ - [L]

Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » Apache

View last 200 lines of all access logs on apache server

find [path/to/access/logs/folder] -name "*_access_log" -exec sh -c 'tail -200 "$1" | grep -v "HetrixTools\|ok\.txt\|canary" | sed "s/$/ [$(basename "$1" _access_log)]/"' _ {} \; | sort -k4,4

The grep -v "HetrixTools\|ok\.txt\|canary" filters out hits from my uptime monitor.

Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » fail2ban

How to check Fail2ban log

Command to check fail2ban's log is sudo tail -f /var/log/fail2ban.log