Next: , Previous: , Up: 服务   [Contents][Index]


11.10.17 监控服务

Tailon Service

Tailon is a web application for viewing and searching log files.

The following example will configure the service with default values. By default, Tailon can be accessed on port 8080 (http://localhost:8080).

(service tailon-service-type)

The following example customises more of the Tailon configuration, adding sed to the list of allowed commands.

(service tailon-service-type
         (tailon-configuration
           (config-file
             (tailon-configuration-file
               (allowed-commands '("tail" "grep" "awk" "sed"))))))
Data Type: tailon-configuration

Data type representing the configuration of Tailon. This type has the following parameters:

config-file (default: (tailon-configuration-file))

The configuration file to use for Tailon. This can be set to a tailon-configuration-file record value, or any gexp (see G-表达式).

For example, to instead use a local file, the local-file function can be used:

(service tailon-service-type
         (tailon-configuration
           (config-file (local-file "./my-tailon.conf"))))
package (default: tailon)

The tailon package to use.

Data Type: tailon-configuration-file

Data type representing the configuration options for Tailon. This type has the following parameters:

files (default: (list "/var/log"))

List of files to display. The list can include strings for a single file or directory, or a list, where the first item is the name of a subsection, and the remaining items are the files or directories in that subsection.

bind (default: "localhost:8080")

Address and port to which Tailon should bind on.

relative-root (default: #f)

URL path to use for Tailon, set to #f to not use a path.

allow-transfers? (default: #t)

Allow downloading the log files in the web interface.

follow-names? (default: #t)

Allow tailing of not-yet existent files.

tail-lines (default: 200)

Number of lines to read initially from each file.

allowed-commands (default: (list "tail" "grep" "awk"))

Commands to allow running. By default, sed is disabled.

debug? (default: #f)

Set debug? to #t to show debug messages.

wrap-lines (default: #t)

Initial line wrapping state in the web interface. Set to #t to initially wrap lines (the default), or to #f to initially not wrap lines.

http-auth (default: #f)

HTTP authentication type to use. Set to #f to disable authentication (the default). Supported values are "digest" or "basic".

users (default: #f)

If HTTP authentication is enabled (see http-auth), access will be restricted to the credentials provided here. To configure users, use a list of pairs, where the first element of the pair is the username, and the 2nd element of the pair is the password.

(tailon-configuration-file
  (http-auth "basic")
  (users     '(("user1" . "password1")
               ("user2" . "password2"))))

Darkstat Service

Darkstat is a packet sniffer that captures network traffic, calculates statistics about usage, and serves reports over HTTP.

Variable: darkstat-service-type

This is the service type for the darkstat service, its value must be a darkstat-configuration record as in this example:

(service darkstat-service-type
         (darkstat-configuration
           (interface "eno1")))
Data Type: darkstat-configuration

Data type representing the configuration of darkstat.

package (default: darkstat)

The darkstat package to use.

interface

Capture traffic on the specified network interface.

port (default: "667")

Bind the web interface to the specified port.

bind-address (default: "127.0.0.1")

Bind the web interface to the specified address.

base (default: "/")

Specify the path of the base URL. This can be useful if darkstat is accessed via a reverse proxy.

Prometheus Node Exporter Service

The Prometheus “node exporter” makes hardware and operating system statistics provided by the Linux kernel available for the Prometheus monitoring system. This service should be deployed on all physical nodes and virtual machines, where monitoring these statistics is desirable.

Variable: prometheus-node-exporter-service-type

This is the service type for the prometheus-node-exporter service, its value must be a prometheus-node-exporter-configuration.

(service prometheus-node-exporter-service-type)
Data Type: prometheus-node-exporter-configuration

Data type representing the configuration of node_exporter.

package (default: go-github-com-prometheus-node-exporter)

The prometheus-node-exporter package to use.

web-listen-address (default: ":9100")

Bind the web interface to the specified address.

textfile-directory (default: "/var/lib/prometheus/node-exporter")

This directory can be used to export metrics specific to this machine. Files containing metrics in the text format, with the filename ending in .prom should be placed in this directory.

extra-options (default: '())

Extra options to pass to the Prometheus node exporter.

vnStat Network Traffic Monitor

vnStat is a network traffic monitor that uses interface statistics provided by the kernel rather than traffic sniffing. This makes it a light resource monitor, regardless of network traffic rate.

Variable: vnstat-service-type

This is the service type for the vnStat daemon and accepts a vnstat-configuration value.

The following example will configure the service with default values:

(service vnstat-service-type)
Data Type: vnstat-configuration

Available vnstat-configuration fields are:

package (default: vnstat) (type: file-like)

The vnstat package.

database-directory (default: "/var/lib/vnstat") (type: string)

Specifies the directory where the database is to be stored. A full path must be given and a leading ’/’ isn’t required.

5-minute-hours (default: 48) (type: maybe-integer)

Data retention duration for the 5 minute resolution entries. The configuration defines for how many past hours entries will be stored. Set to -1 for unlimited entries or to 0 to disable the data collection of this resolution.

64bit-interface-counters (default: -2) (type: maybe-integer)

Select interface counter handling. Set to 1 for defining that all interfaces use 64-bit counters on the kernel side and 0 for defining 32-bit counter. Set to -1 for using the old style logic used in earlier versions where counter values within 32-bits are assumed to be 32-bit and anything larger is assumed to be a 64-bit counter. This may produce false results if a 64-bit counter is reset within the 32-bits. Set to -2 for using automatic detection based on available kernel datastructures.

always-add-new-interfaces? (default: #t) (type: maybe-boolean)

Enable or disable automatic creation of new database entries for interfaces not currently in the database even if the database file already exists when the daemon is started. New database entries will also get created for new interfaces seen while the daemon is running. Pseudo interfaces ‘lo’, ‘lo0’ and ‘sit0’ are always excluded from getting added.

bandwidth-detection? (default: #t) (type: maybe-boolean)

Try to automatically detect max-bandwidth value for each monitored interface. Mostly only ethernet interfaces support this feature. max-bandwidth will be used as fallback value if detection fails. Any interface specific max-BW configuration will disable the detection for the specified interface. In Linux, the detection is disabled for tun interfaces due to the Linux kernel always reporting 10 Mbit regardless of the used real interface.

bandwidth-detection-interval (default: 5) (type: maybe-integer)

How often in minutes interface specific detection of max-bandwidth is done for detecting possible changes when bandwidth-detection is enabled. Can be disabled by setting to 0. Value range: ‘0’..‘30

boot-variation (default: 15) (type: maybe-integer)

Time in seconds how much the boot time reported by system kernel can variate between updates. Value range: ‘0’..‘300

check-disk-space? (default: #t) (type: maybe-boolean)

Enable or disable the availability check of at least some free disk space before a database write.

create-directories? (default: #t) (type: maybe-boolean)

Enable or disable the creation of directories when a configured path doesn’t exist. This includes database-directory.

daemon-group (type: maybe-user-group)

Specify the group to which the daemon process should switch during startup. Set to %unset-value to disable group switching.

daemon-user (type: maybe-user-account)

Specify the user to which the daemon process should switch during startup. Set to %unset-value to disable user switching.

daily-days (default: 62) (type: maybe-integer)

Data retention duration for the one day resolution entries. The configuration defines for how many past days entries will be stored. Set to -1 for unlimited entries or to 0 to disable the data collection of this resolution.

database-synchronous (default: -1) (type: maybe-integer)

Change the setting of the SQLite "synchronous" flag which controls how much care is taken to ensure disk writes have fully completed when writing data to the database before continuing other actions. Higher values take extra steps to ensure data safety at the cost of slower performance. A value of 0 will result in all handling being left to the filesystem itself. Set to -1 to select the default value according to database mode controlled by database-write-ahead-logging setting. See SQLite documentation for more details regarding values from 1 to 3. Value range: ‘-1’..‘3

database-write-ahead-logging? (default: #f) (type: maybe-boolean)

Enable or disable SQLite Write-Ahead Logging mode for the database. See SQLite documentation for more details and note that support for read-only operations isn’t available in older SQLite versions.

hourly-days (default: 4) (type: maybe-integer)

Data retention duration for the one hour resolution entries. The configuration defines for how many past days entries will be stored. Set to -1 for unlimited entries or to 0 to disable the data collection of this resolution.

log-file (type: maybe-string)

Specify log file path and name to be used if use-logging is set to 1.

max-bandwidth (type: maybe-integer)

Maximum bandwidth for all interfaces. If the interface specific traffic exceeds the given value then the data is assumed to be invalid and rejected. Set to 0 in order to disable the feature. Value range: ‘0’..‘50000

max-bw (type: maybe-alist)

Same as max-bandwidth but can be used for setting individual limits for selected interfaces. This is an association list of interfaces as strings to integer values. For example,

(max-bw `(("eth0" .  15000)
          ("ppp0" .  10000)))

bandwidth-detection is disabled on an interface specific level for each max-bw configuration. Value range: ‘0’..‘50000

monthly-months (default: 25) (type: maybe-integer)

Data retention duration for the one month resolution entries. The configuration defines for how many past months entries will be stored. Set to -1 for unlimited entries or to 0 to disable the data collection of this resolution.

month-rotate (default: 1) (type: maybe-integer)

Day of month that months are expected to change. Usually set to 1 but can be set to alternative values for example for tracking monthly billed traffic where the billing period doesn’t start on the first day. For example, if set to 7, days of February up to and including the 6th will count for January. Changing this option will not cause existing data to be recalculated. Value range: ‘1’..‘28

month-rotate-affects-years? (default: #f) (type: maybe-boolean)

Enable or disable month-rotate also affecting yearly data. Applicable only when month-rotate has a value greater than one.

offline-save-interval (default: 30) (type: maybe-integer)

How often in minutes cached interface data is saved to file when all monitored interfaces are offline. Value range: save-interval..‘60

pid-file (default: "/var/run/vnstatd.pid") (type: maybe-string)

Specify pid file path and name to be used.

poll-interval (default: 5) (type: maybe-integer)

How often in seconds interfaces are checked for status changes. Value range: ‘2’..‘60

rescan-database-on-save? (type: maybe-boolean)

Automatically discover added interfaces from the database and start monitoring. The rescan is done every save-interval or offline-save-interval minutes depending on the current activity state.

save-interval (default: 5) (type: maybe-integer)

How often in minutes cached interface data is saved to file. Value range: ( update-interval / 60 )..‘60

save-on-status-change? (default: #t) (type: maybe-boolean)

Enable or disable the additional saving to file of cached interface data when the availability of an interface changes, i.e., when an interface goes offline or comes online.

time-sync-wait (default: 5) (type: maybe-integer)

How many minutes to wait during daemon startup for system clock to sync if most recent database update appears to be in the future. This may be needed in systems without a real-time clock (RTC) which require some time after boot to query and set the correct time. 0 = wait disabled. Value range: ‘0’..‘60

top-day-entries (default: 20) (type: maybe-integer)

Data retention duration for the top day entries. The configuration defines how many of the past top day entries will be stored. Set to -1 for unlimited entries or to 0 to disable the data collection of this resolution.

trafficless-entries? (default: #t) (type: maybe-boolean)

Create database entries even when there is no traffic during the entry’s time period.

update-file-owner? (default: #t) (type: maybe-boolean)

Enable or disable the update of file ownership during daemon process startup. During daemon startup, only database, log and pid files will be modified if the user or group change feature ( daemon-user or daemon-group ) is enabled and the files don’t match the requested user or group. During manual database creation, this option will cause file ownership to be inherited from the database directory if the directory already exists. This option only has effect when the process is started as root or via sudo.

update-interval (default: 20) (type: maybe-integer)

How often in seconds the interface data is updated. Value range: poll-interval..‘300

use-logging (default: 2) (type: maybe-integer)

Enable or disable logging. Accepted values are: 0 = disabled, 1 = logfile and 2 = syslog.

use-utc? (type: maybe-boolean)

Enable or disable using UTC as timezone in the database for all entries. When enabled, all entries added to the database will use UTC regardless of the configured system timezone. When disabled, the configured system timezone will be used. Changing this setting will not result in already existing data to be modified.

yearly-years (default: -1) (type: maybe-integer)

Data retention duration for the one year resolution entries. The configuration defines for how many past years entries will be stored. Set to -1 for unlimited entries or to 0 to disable the data collection of this resolution.

Zabbix server

Zabbix is a high performance monitoring system that can collect data from a variety of sources and provide the results in a web-based interface. Alerting and reporting is built-in, as well as templates for common operating system metrics such as network utilization, CPU load, and disk space consumption.

This service provides the central Zabbix monitoring service; you also need zabbix-front-end-service-type to configure Zabbix and display results, and optionally zabbix-agent-service-type on machines that should be monitored (other data sources are supported, such as Prometheus Node Exporter).

Variable: zabbix-server-service-type

This is the service type for the Zabbix server service. Its value must be a zabbix-server-configuration record, shown below.

Data Type: zabbix-server-configuration

Available zabbix-server-configuration fields are:

zabbix-server (default: zabbix-server) (type: file-like)

The zabbix-server package.

user (default: "zabbix") (type: string)

User who will run the Zabbix server.

group (default: "zabbix") (type: string)

Group who will run the Zabbix server.

db-host (default: "127.0.0.1") (type: string)

Database host name.

db-name (default: "zabbix") (type: string)

Database name.

db-user (default: "zabbix") (type: string)

Database user.

db-password (default: "") (type: string)

Database password. Please, use include-files with DBPassword=SECRET inside a specified file instead.

db-port (default: 5432) (type: number)

Database port.

log-type (default: "") (type: string)

Specifies where log messages are written to:

  • system - syslog.
  • file - file specified with log-file parameter.
  • console - standard output.
log-file (default: "/var/log/zabbix/server.log") (type: string)

Log file name for log-type file parameter.

pid-file (default: "/var/run/zabbix/zabbix_server.pid") (type: string)

Name of PID file.

ssl-ca-location (default: "/etc/ssl/certs/ca-certificates.crt") (type: string)

The location of certificate authority (CA) files for SSL server certificate verification.

ssl-cert-location (default: "/etc/ssl/certs") (type: string)

Location of SSL client certificates.

extra-options (default: "") (type: extra-options)

Extra options will be appended to Zabbix server configuration file.

include-files (default: '()) (type: include-files)

You may include individual files or all files in a directory in the configuration file.

Zabbix agent

The Zabbix agent gathers information about the running system for the Zabbix monitoring server. It has a variety of built-in checks, and can be extended with custom user parameters.

Variable: zabbix-agent-service-type

This is the service type for the Zabbix agent service. Its value must be a zabbix-agent-configuration record, shown below.

Data Type: zabbix-agent-configuration

Available zabbix-agent-configuration fields are:

zabbix-agent (default: zabbix-agentd) (type: file-like)

The zabbix-agent package.

user (default: "zabbix") (type: string)

User who will run the Zabbix agent.

group (default: "zabbix") (type: string)

Group who will run the Zabbix agent.

hostname (default: "") (type: string)

Unique, case sensitive hostname which is required for active checks and must match hostname as configured on the server.

log-type (default: "") (type: string)

Specifies where log messages are written to:

  • system - syslog.
  • file - file specified with log-file parameter.
  • console - standard output.
log-file (default: "/var/log/zabbix/agent.log") (type: string)

Log file name for log-type file parameter.

pid-file (default: "/var/run/zabbix/zabbix_agent.pid") (type: string)

Name of PID file.

server (default: '("127.0.0.1")) (type: list)

List of IP addresses, optionally in CIDR notation, or hostnames of Zabbix servers and Zabbix proxies. Incoming connections will be accepted only from the hosts listed here.

server-active (default: '("127.0.0.1")) (type: list)

List of IP:port (or hostname:port) pairs of Zabbix servers and Zabbix proxies for active checks. If port is not specified, default port is used. If this parameter is not specified, active checks are disabled.

extra-options (default: "") (type: extra-options)

Extra options will be appended to Zabbix server configuration file.

include-files (default: '()) (type: include-files)

You may include individual files or all files in a directory in the configuration file.

Zabbix front-end

The Zabbix front-end provides a web interface to Zabbix. It does not need to run on the same machine as the Zabbix server. This service works by extending the PHP-FPM and NGINX services with the configuration necessary for loading the Zabbix user interface.

Variable: zabbix-front-end-service-type

This is the service type for the Zabbix web frontend. Its value must be a zabbix-front-end-configuration record, shown below.

Data Type: zabbix-front-end-configuration

Available zabbix-front-end-configuration fields are:

zabbix-server (default: zabbix-server) (type: file-like)

The Zabbix server package to use.

nginx (default: '()) (type: list)

List of nginx-server-configuration blocks for the Zabbix front-end. When empty, a default that listens on port 80 is used.

db-host (default: "localhost") (type: string)

Database host name.

db-port (default: 5432) (type: number)

Database port.

db-name (default: "zabbix") (type: string)

Database name.

db-user (default: "zabbix") (type: string)

Database user.

db-password (default: "") (type: string)

Database password. Please, use db-secret-file instead.

db-secret-file (default: "") (type: string)

Secret file which will be appended to zabbix.conf.php file. This file contains credentials for use by Zabbix front-end. You are expected to create it manually.

zabbix-host (default: "localhost") (type: string)

Zabbix server hostname.

zabbix-port (default: 10051) (type: number)

Zabbix server port.


Next: Kerberos服务, Previous: File-Sharing Services, Up: 服务   [Contents][Index]