-
Notifications
You must be signed in to change notification settings - Fork 3
98_ApacheStatus.pm
ApacheStatus queries a server-statuspage generated by Apaches mod_status and generates various readings from it. The query is repeated in a given interval.
Prerequisites
- HTML::TreeBuilder::XPath needs to be installed. (debian: apt-get install libhtml-treebuilder-xpath-perl)
- mod_status needs to be enabled in Apache
- server-status-page must be accessible for fhem (/etc/apache2/mods-enabled/status.conf may restrict access)
Define
define <name> ApacheStatus <URL> [<INTERVAL>]
Example: define APACHESTATUS ApacheStatus http://localhost/server-status 300
URL is the url of a server-statuspage generated by mod_status. User and password for HTTP basic authentication may be provided in standard notation: http://user:pass@host
INTERVAL is the refresh interval in seconds. Default: 300
Since ApacheStatus is designed to create very differentiated readings from the info mod_status provides, it can easily make for hundreds of readings. To avoid that, you'll have to explicitly enable groups of readings by setting associated attributes. For details see below.
A newly created device has some attributes set to default values:
- autoReset: yes
- disabled: no
- event-on-change-reading: .*
- keepBuf: no
- keepOldReadings: no
- readingsChilds: no
- readingsChildColumnDesc: no
- readingsChildsRowFilter: !request:^OPTIONS !request:^NULL
- readingsChildsColumnFilter: req conn child client request
- readingsClients: no
- readingsScoreboard: no
- readingsServer: no
- readingsSSL: no
Set
-
allreadings yes|no
Sets all readings-attributes to "yes" or "no" -
disable
Disables automatic refresh (enabled by default) -
enable
Enables automatic refresh -
reset
Deletes all readings and rereads them -
refresh
Immediately refreshes all readings
Attributes
-
autoReset yes|no
Since most attributes do effect the creation of readings, the module automatically resets all readings when changing attributes. Set to "no" to disable this behaviour. May be usefull if you want to keep outdated readings (see keepOldReadings bellow). Default: yes -
disabled yes|no
Disables automatic refresh. disabledForIntervals has higher precedence then disabled=no. Default: no - disabledForIntervals
-
httpVersion #
HTTP-Version to send to the server. Inherited from HttpUtils. Default: 1.0 -
keepBuf yes|no
Keep server-status-HTML in the internal value 'buf'? Default: no -
keepOldReadings yes|no
Keep readings which aren't present in the last fetch of server-status? Caution: set DEVICE reset deletes all readings regardless of keepOldReadings. Default: no -
localnetwork <regex>
Regular expression that matches all adresses in your local network. It is used to distinguish local clients from external clients when counting client requests. localhost-adresses (127.0.0.1, ::1) are always counted to the local network automatically
Example: 192.168.178 -
readingsChildColumnDesc yes|no
The server-status page contains a description of all columns of the table with child-information (see below). If set to yes, these descriptions are transfered as readings. Default: no -
readingsChilds yes|no
Create readings of the table with child-information ("Srv PID Acc.."). For each row and each colum a single reading is created. Caution: This can easily make for hundrets of readings, avoid usage without readingsChildsRowFilter/readingsChildsColumnFilter. Default: no -
readingsChildsRowFilter <column:regex> <column:regex> ...
Only include rows of readings of child-information, when at least one condition in the space separated list of colum:regex-pairs is met.
- column is the title of a column of that table (e.g. "srv", "pid", "acc") and may be preceeded with an ! to negate the following regex.
- regex is a regular expression describing the value of a cell
Example: request:^GET !client:^127.0.0.1$
-
readingsChildsColumnsFilter <column> <column> ...
If the attribute is set, readings are included only for columns that are listed here. Otherwise all columns are included.
Example: client request
-
readingsClients yes|no
Create readings for the count of requests per client? Default: no -
readingsSSL yes|no
Create readings from the SSL/TLS session cache status-table? This table is not always included in server-status. Default: no -
readingsServer yes|no
Create readings from server information (top of status-page)? Default: no -
readingsScoreboard yes|no
Create readings from the scoreboard? Default: no -
timeout #
Timeout to wait for servers response. Inherited from HttpUtils. Default: 2 - readingFnAttributes
-
defined
device is defined -
fetching
device is fetching it's URL -
parsing
device is parsing HTML (response from fetching URL) -
done
device is done parsing and waiting for the next run -
disabled
device is disabled -
error
an error occured
-
readingsClients yes|no