https://serverfault.com/questions/226982/how-to-measure-req-sec-by-analyzing-apache-logs
This great article helped me a lot...
I had created a set of prepered commands that I am using to analyze apache log:
#!/bin/bash | |
echo "Refreshing repository certificates." | |
echo ' | |
organizations = Organization.all | |
organizations.each do |org| | |
repositories = ::Katello::Repository.in_default_view.in_product(::Katello::Product.redhat.in_org(org)) | |
repositories.each do |repo| | |
task = ForemanTasks.async_task(Actions::Katello::Repository::RefreshRepository, repo) |
./app/lib/actions/katello/organization/manifest_refresh.rb | |
module Actions | |
module Katello | |
module Organization | |
class ManifestRefresh < Actions::AbstractAsyncTask | |
middleware.use Actions::Middleware::PropagateCandlepinErrors | |
def plan(organization) | |
action_subject organization | |
manifest_update = organization.products.redhat.any? |
echo "select usesysid,usename,state,waiting,query from pg_stat_activity where state = 'active'" | sudo -u postgres psql |
curl https://mirrors.rit.edu/fedora/epel/7/x86_64/Packages/f/fuse-sshfs-2.10-1.el7.x86_64.rpm > fuse-sshfs-2.10-1.el7.x86_64.rpm | |
yum -y install fuse-sshfs-2.10-1.el7.x86_64.rpm | |
mkdir /mnt/remote | |
sshfs -o allow_other [email protected]:/ /mnt/remote |
#!/bin/bash | |
TABLEQUERY=$(cat <<-END | |
SELECT table_name, pg_size_pretty(total_bytes) AS total | |
, pg_size_pretty(index_bytes) AS INDEX | |
, pg_size_pretty(toast_bytes) AS toast | |
, pg_size_pretty(table_bytes) AS TABLE | |
FROM ( | |
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM ( |
https://serverfault.com/questions/226982/how-to-measure-req-sec-by-analyzing-apache-logs
This great article helped me a lot...
I had created a set of prepered commands that I am using to analyze apache log:
SELECT d.datname AS Name, pg_catalog.pg_get_userbyid(d.datdba) AS Owner, | |
CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') | |
THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname)) | |
ELSE 'No Access' | |
END AS SIZE | |
FROM pg_catalog.pg_database d | |
ORDER BY | |
CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') | |
THEN pg_catalog.pg_database_size(d.datname) | |
ELSE NULL |
function getReadableFileSizeString(fileSizeInBytes) { | |
var i = -1; | |
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; | |
do { | |
fileSizeInBytes = fileSizeInBytes / 1024; | |
i++; | |
} while (fileSizeInBytes > 1024); | |
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]; |
#!/bin/bash | |
systemctl stop foreman-tasks.service | |
cat <<EOF | foreman-rake console | |
User.current = User.anonymous_admin | |
ForemanTasks::Task.where(:label => "Actions::Candlepin::ListenOnCandlepinEvents").destroy_all | |
ForemanTasks::Task.where(:label => "Actions::Katello::EventQueue::Monitor").destroy_all | |
EOF | |
systemctl start foreman-tasks.service |
#!/usr/bin/env ruby | |
require 'yaml' | |
require 'oauth' | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE | |
katello_config = YAML.load_file('/etc/foreman/plugins/katello.yaml') | |
consumer_key = katello_config[:katello][:candlepin][:oauth_key] | |
consumer_secret = katello_config[:katello][:candlepin][:oauth_secret] |