LinuxCommandLibrary

sqsc

Manage AWS Simple Queue Service queues

TLDR

List all queues

$ sqsc lq [queue_prefix]
copy

List all messages in a queue
$ sqsc ls [queue_name]
copy

Copy all messages from one queue to another
$ sqsc cp [source_queue] [destination_queue]
copy

Move all messages from one queue to another
$ sqsc mv [source_queue] [destination_queue]
copy

Describe a queue
$ sqsc describe [queue_name]
copy

Query a queue with SQL syntax
$ sqsc query "SELECT body FROM [queue_name] WHERE body LIKE '%user%'"
copy

Pull all messages from a queue into a local SQLite database in your present working directory
$ sqsc pull [queue_name]
copy

SYNOPSIS

sqsc [OPTIONS] HOST[:PORT] COMMAND

PARAMETERS

HOST
    The hostname or IP address of the Squid proxy server to query. Default is localhost.

PORT
    The Cache Manager port of the Squid proxy server. Default is 3401, or the value configured by cache_manager_port in squid.conf.

COMMAND
    The specific Cache Manager command to execute on the Squid server. Common commands include info, utilization, counters, objects, 5min, 60min, mem, store_mem, config, shutdown, and reconfigure. The available commands depend on the Squid version and configuration.

-h HOST
    Explicitly specify the Squid cache host (alternative to positioning HOST).

-p PORT
    Explicitly specify the Squid cache manager port (alternative to positioning PORT).

-u USERNAME
    Specify the username for Cache Manager authentication (if cachemgr_passwd is configured).

-w PASSWORD
    Specify the password for Cache Manager authentication (if cachemgr_passwd is configured).

DESCRIPTION

sqsc (Squid Cache Status Client) is a command-line utility used to query and retrieve real-time operational status and various statistics from a running Squid web proxy cache server. It communicates with Squid's Cache Manager interface, typically over UDP, to gather valuable insights into the proxy's performance and health. Administrators use sqsc to monitor aspects like memory usage, disk cache activity, network traffic, client connections, and object counts, providing a quick and efficient way to assess the proxy's state without needing to access the server directly or parse complex log files.

The information returned by sqsc helps in understanding the current load, cache hit ratios, and resource consumption, which are crucial for maintaining an efficient and reliable proxy service.

CAVEATS

sqsc relies on Squid's Cache Manager interface being enabled and accessible. For sensitive commands like shutdown or reconfigure, Squid's cachemgr_passwd must be configured for security. The default communication uses UDP, which is connectionless and may not guarantee delivery, though typically reliable enough for status queries. sqsc is usually part of the squid-helpers or squid package and may not be installed by default on systems without a Squid server.

COMMON USE CASES

Automated Monitoring: Integrate sqsc into scripts to periodically check Squid's health and performance.
Troubleshooting: Quickly diagnose issues by checking current statistics like errors, cache misses, or high resource usage.
Capacity Planning: Use long-term trends from sqsc output to understand proxy load and plan for future capacity needs.

OUTPUT FORMAT

The output of sqsc is typically plain text, often presented as key-value pairs or structured tables, making it relatively easy to parse with standard text processing tools like grep, awk, or sed for automation purposes. The specific format varies depending on the COMMAND issued.

HISTORY

The sqsc utility has been an integral part of the Squid web proxy cache project since its early development. Squid, initially known as Harvest Cache and later renamed in 1996, grew to become a widely used open-source caching proxy. sqsc was developed to provide administrators with a direct command-line interface to monitor and manage running Squid instances, complementing the web-based Cache Manager interface (accessible via cachemgr.cgi). Its design reflects the need for a simple, scriptable tool to quickly query Squid's internal state, evolving alongside the Squid daemon to support new metrics and management commands.

SEE ALSO

squid(8), squidclient(1), cachemgr.cgi(8), netstat(8), ss(8)

Copied to clipboard