Oproxyctl

From ISPWiki

Jump to: navigation, search

Contents

Description

The utility is intended for managing oProxy and viewing its internal statistics.

It must know the path to the oProxy socket. The path is read and is set to /tmp/oproxy.sock. by default. You can change it with the --socket key:

/usr/local/ispmgr/sbin/oproxyctl --socket /other/path/oproxy.sock command

Operating mode

The mode is specified with commands. One can specify several commands in one line:

/usr/local/ispmgr/sbin/oproxyctl command1 command2

Stopping oProxy (stop daemon)

/usr/local/ispmgr/sbin/oproxyctl 'stop daemon'

oProxy will be correctly stopped.

Viewing worker processes (show workers)

/usr/local/ispmgr/sbin/oproxyctl 'show workers'

The output will be as follows:

id	pid	closed_connections
0	19932	1818
1	19933	1842
2	19934	1821
3	19935	1864

id — the worker process internal identifier

pid — process ID

closed_connections — the number of closed connections

Viewing backends information (show nodes <http|mysql>)

/usr/local/ispmgr/sbin/oproxyctl 'show nodes http'

The output will be as follows:

id	ip		active_connections	closed_connections	active
0	10.0.0.1	3			1289			on
1	10.0.0.2	4			1353			on
2	10.0.0.3	4			1410			on

ip — the node IP-address

active_connections — the number of connections that are currently being processed

closed_connections — the number of closed connections

active — the node status. off means that a node is marked as down

By using the 'show nodes mysql' command you can monitor the MySQL nodes statistics.

Viewing relatively current traffic (show traffic <http|mysql>)

Why "relatively current"? The worker processes statistics renews once in 3 seconds. The command may show information that is some seconds outdated.

/usr/local/ispmgr/sbin/oproxyctl 'show traffic http'
/usr/local/ispmgr/sbin/oproxyctl 'show traffic mysql'

The output will be as follows:

host			received	sent	time	requests
host.com		144872		1038753	5.12540	193
site.com		474		242807	0.00000	1
somesite.info		92		71904	0.46369	1

host (for http) — host name

user (for mysql) — user name

received — the amount of data received from client

sent — the amount of data sent to client

time — total response time

requests — the number of processed requests

Please note! Statistics resets once put to the statistics file (if customized).

Resetting traffic statistics

/usr/local/ispmgr/sbin/oproxyctl 'reset traffic'

Managing monitoring list

oProxy enables to log requests that can be further used to analyse performance, etc. Very often clients may exceed allocated resources and they want to know the reason why. For this purpose a request micro language to oProxy OpQL was developed

For example, a nobody MySQL-user exceeded the load limit on MySQL. You can write a command:

/usr/local/ispmgr/sbin/oproxyctl 'start save time, sent, query from mysql where user = "nobody" into file "/home/nobody/data/mysql_load.txt"'

From this moment, oProxy starts saving all the requests from the nobody user to MySQL into a specified file. It will record the request time, number of bytes sent to a client and the request itself. To stop saving the information, you need to write the same command specifying stop instead of start at the beginning.

/usr/local/ispmgr/sbin/oproxyctl 'stop save time, sent, query from mysql where user = "nobody" into file "/home/nobody/data/mysql_load.txt"'

The information is not logged any more. Consider another example:

/usr/local/ispmgr/sbin/oproxyctl 'start save current_time, time/60, sent/1024/1024, host, uri
  from http
  where host = "somesite.com"
    and ((uri = "/" and time < 0.5) or (uri = "/news/" and time > 0.01))
  into file "/tmp/requests.txt";
stop save host from http into file "/tmp/all_http.txt"'

You can view the current monitoring list:

/usr/local/ispmgr/sbin/oproxyctl 'show queries'

Its syntax is described in OpQL.

Command line options

--socket /tmp/oproxy.sock

Path to the master socket. /tmp/oproxy.sock is used by default.

--field-separator <tabulation>

Line separator. A tabulation character is used by default.

--record-separator <new_line>

Record separator . A new-line character is used by default.

--console

The command line interface for managing oProxy.

--help

Usage information.

Was this helpful? Yes | No
Personal tools