mtail for tealc from the future
							parent
							
								
									d649aa6360
								
							
						
					
					
						commit
						c6e11e398f
					
				| 
						 | 
					@ -77,8 +77,10 @@
 | 
				
			||||||
#  roles: ["prometheus-node-exporter-postfix"]
 | 
					#  roles: ["prometheus-node-exporter-postfix"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Monitor logs with mtail
 | 
					# Monitor logs with mtail
 | 
				
			||||||
#- hosts: thot.adm.crans.org
 | 
					- hosts: tealc.adm.crans.org
 | 
				
			||||||
#  roles: ["mtail"]
 | 
					  vars:
 | 
				
			||||||
 | 
					    mirror: '{{ glob_mirror | default({}) | combine(loc_mirror | default({})) }}'
 | 
				
			||||||
 | 
					  roles: ["mtail"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- hosts: sputnik.adm.crans.org
 | 
					- hosts: sputnik.adm.crans.org
 | 
				
			||||||
  roles: ["statping"]
 | 
					  roles: ["statping"]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,16 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					- name: Pin mtail
 | 
				
			||||||
 | 
					  template:
 | 
				
			||||||
 | 
					    src: "apt/{{ item }}.j2"
 | 
				
			||||||
 | 
					    dest: "/etc/apt/{{ item }}"
 | 
				
			||||||
 | 
					  loop:
 | 
				
			||||||
 | 
					    - sources.list.d/bullseye.list
 | 
				
			||||||
 | 
					    - preferences.d/mtail-bullseye
 | 
				
			||||||
 | 
					  when:
 | 
				
			||||||
 | 
					    - ansible_distribution == "Debian"
 | 
				
			||||||
 | 
					    - ansible_distribution_major_version | int <= 10
 | 
				
			||||||
 | 
					    - ansible_distribution_release != "bullseye"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Install mtail
 | 
					- name: Install mtail
 | 
				
			||||||
  apt:
 | 
					  apt:
 | 
				
			||||||
    update_cache: true
 | 
					    update_cache: true
 | 
				
			||||||
| 
						 | 
					@ -17,6 +29,7 @@
 | 
				
			||||||
  template:
 | 
					  template:
 | 
				
			||||||
    src: "mtail/{{ item }}.j2"
 | 
					    src: "mtail/{{ item }}.j2"
 | 
				
			||||||
    dest: "/etc/mtail/{{ item }}"
 | 
					    dest: "/etc/mtail/{{ item }}"
 | 
				
			||||||
 | 
					    mode: 0644
 | 
				
			||||||
  loop:
 | 
					  loop:
 | 
				
			||||||
    - dhcpd.mtail
 | 
					    - dhcpd.mtail
 | 
				
			||||||
    - radiusd.mtail
 | 
					    - radiusd.mtail
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Package: *
 | 
				
			||||||
 | 
					Pin: release n=bullseye
 | 
				
			||||||
 | 
					Pin-Priority: 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Package: mtail
 | 
				
			||||||
 | 
					Pin: release n=bullseye
 | 
				
			||||||
 | 
					Pin-Priority: 900
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					deb http://{{ mirror.name }}/debian bullseye main
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,6 @@
 | 
				
			||||||
{{ ansible_header | comment }}
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
# Set to 1 to start Mtail at boot.
 | 
					 | 
				
			||||||
ENABLED=1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Log processing.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# List of files to monitor (mandatory).
 | 
					# List of files to monitor (mandatory).
 | 
				
			||||||
LOGS=/var/log/cablage/global.log
 | 
					LOGS=/var/log/daemon.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Metrics exporting.
 | 
					## Metrics exporting.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,4 +20,4 @@ LOGS=/var/log/cablage/global.log
 | 
				
			||||||
#METRIC_PUSH_INTERVAL=
 | 
					#METRIC_PUSH_INTERVAL=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Extra command-line arguments to pass to the server.
 | 
					# Extra command-line arguments to pass to the server.
 | 
				
			||||||
EXTRA_ARGS=""
 | 
					#EXTRA_ARGS=""
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
{{ ansible_header | comment }}
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
# Copyright 2011 Google Inc. All Rights Reserved.
 | 
					# Copyright 2008 Google Inc. All Rights Reserved.
 | 
				
			||||||
# This file is available under the Apache license.
 | 
					# This file is available under the Apache license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Define the exported metric names.  The `by' keyword indicates the metric has
 | 
					# Define the exported metric names.  The `by' keyword indicates the metric has
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ def syslog {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    # If the RFC3339 style matched, parse it this way.
 | 
					    # If the RFC3339 style matched, parse it this way.
 | 
				
			||||||
    len($rfc3339_date) > 0 {
 | 
					    len($rfc3339_date) > 0 {
 | 
				
			||||||
      strptime($rfc3339_date, "2006-01-02T15:04:05.999999999Z07:00")
 | 
					      strptime($rfc3339_date, "2006-01-02T03:04:05-0700")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    # Call into the decorated block
 | 
					    # Call into the decorated block
 | 
				
			||||||
    next
 | 
					    next
 | 
				
			||||||
| 
						 | 
					@ -52,14 +52,14 @@ const MATCH_MAC /(?P<mac>([\da-f]{2}:){5}[\da-f]{2})/
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@syslog {
 | 
					@syslog {
 | 
				
			||||||
    # Request
 | 
					    # Request
 | 
				
			||||||
    /(balanced|balancing|BOOTREPLY|BOOTREQUEST|DHCPACK|DHCPDECLINE|DHCPDISCOVER|DHCPINFORM|DHCPNAK|DHCPOFFER|DHCPRELEASE|DHCPREQUEST)/ {
 | 
					    $message =~ /^(balanced|balancing|BOOTREPLY|BOOTREQUEST|DHCPACK|DHCPDECLINE|DHCPDISCOVER|DHCPINFORM|DHCPNAK|DHCPOFFER|DHCPRELEASE|DHCPREQUEST)/ {
 | 
				
			||||||
        # The lowercased name of the command matched in the regex is used to
 | 
					        # The lowercased name of the command matched in the regex is used to
 | 
				
			||||||
        # count the frequency of each command.  An external collector can use
 | 
					        # count the frequency of each command.  An external collector can use
 | 
				
			||||||
        # this to compute the rate of each command independently.
 | 
					        # this to compute the rate of each command independently.
 | 
				
			||||||
        dhcpd_request_total[tolower($1)]++
 | 
					        dhcpd_request_total[tolower($1)]++
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # DHCP Discover
 | 
					        # DHCP Discover
 | 
				
			||||||
        /DHCPDISCOVER from / + MATCH_MAC {
 | 
					        $message =~ /^DHCPDISCOVER from / + MATCH_MAC {
 | 
				
			||||||
            # Counts the discovery requests.
 | 
					            # Counts the discovery requests.
 | 
				
			||||||
            dhcpd_dhcpdiscovers++
 | 
					            dhcpd_dhcpdiscovers++
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,19 +21,13 @@ def syslog {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    # If the RFC3339 style matched, parse it this way.
 | 
					    # If the RFC3339 style matched, parse it this way.
 | 
				
			||||||
    len($rfc3339_date) > 0 {
 | 
					    len($rfc3339_date) > 0 {
 | 
				
			||||||
      strptime($rfc3339_date, "2006-01-02T15:04:05.999999999Z07:00")
 | 
					      strptime($rfc3339_date, "2006-01-02T03:04:05-0700")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    # Call into the decorated block
 | 
					    # Call into the decorated block
 | 
				
			||||||
    next
 | 
					    next
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Define some pattern constants for reuse in the patterns below.
 | 
					 | 
				
			||||||
const IP /\d+(\.\d+){3}/
 | 
					 | 
				
			||||||
const MATCH_IP /(?P<ip>/ + IP + /)/
 | 
					 | 
				
			||||||
const MATCH_NETWORK /(?P<network>\d+(\.\d+){1,3}\/\d+)/
 | 
					 | 
				
			||||||
const MATCH_MAC /(?P<mac>([\da-f]{2}:){5}[\da-f]{2})/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@syslog {
 | 
					@syslog {
 | 
				
			||||||
    # Access ok!
 | 
					    # Access ok!
 | 
				
			||||||
    /Access ok/ {
 | 
					    /Access ok/ {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@ scrape_configs:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - job_name: mtail
 | 
					  - job_name: mtail
 | 
				
			||||||
    static_configs:
 | 
					    static_configs:
 | 
				
			||||||
    - targets: ["thot.adm.crans.org"]
 | 
					    - targets: ["tealc.adm.crans.org"]
 | 
				
			||||||
    relabel_configs:
 | 
					    relabel_configs:
 | 
				
			||||||
      # Do not put :3903 in instance name, rather here
 | 
					      # Do not put :3903 in instance name, rather here
 | 
				
			||||||
      - source_labels: [__address__]
 | 
					      - source_labels: [__address__]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue