diff --git a/README.md b/README.md index 759a49b9..493d5b45 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ There are multiple ways to install this project, from a standalone app to a [ful - latest from source repository: `❯ pip install git+https://github.com/akpw/mktxp` - +- with the [sample Kubernetes deployment](deploy/kubernetes/deployment.yaml) ## Getting started diff --git a/deploy/kubernetes/deployment.yaml b/deploy/kubernetes/deployment.yaml new file mode 100644 index 00000000..ab4badd1 --- /dev/null +++ b/deploy/kubernetes/deployment.yaml @@ -0,0 +1,47 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mktxp-exporter +spec: + selector: + matchLabels: + app: mktxp-exporter + template: + metadata: + labels: + app: mktxp-exporter + spec: + containers: + - name: mktxp-exporter + image: ghcr.io/akpw/mktxp:latest + args: + - --cfg-dir + - /mktxp_config + - export + resources: + limits: + memory: "512Mi" + cpu: "500m" + volumeMounts: + - name: mktxp-credentials + mountPath: /mktxp_config + ports: + - containerPort: 49090 + volumes: + - name: mktxp-credentials + secret: + secretName: mktxp-credentials +--- +apiVersion: v1 +kind: Service +metadata: + name: mktxp-exporter + annotations: + prometheus.io/port: "49090" + prometheus.io/scrape: "true" +spec: + selector: + app: mktxp-exporter + ports: + - port: 49090 + targetPort: 49090 diff --git a/deploy/kubernetes/secret.yaml b/deploy/kubernetes/secret.yaml new file mode 100644 index 00000000..67b5769f --- /dev/null +++ b/deploy/kubernetes/secret.yaml @@ -0,0 +1,101 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mktxp-credentials +type: Opaque +stringData: + _mktxp.conf: | + ## Source: https://github.com/akpw/mktxp/blob/main/mktxp/cli/config/_mktxp.conf + ## Copyright (c) 2020 Arseniy Kuznetsov + ## + ## This program is free software; you can redistribute it and/or + ## modify it under the terms of the GNU General Public License + ## as published by the Free Software Foundation; either version 2 + ## of the License, or (at your option) any later version. + ## + ## This program is distributed in the hope that it will be useful, + ## but WITHOUT ANY WARRANTY; without even the implied warranty of + ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ## GNU General Public License for more details. + + + [MKTXP] + port = 49090 + socket_timeout = 2 + + initial_delay_on_failure = 120 + max_delay_on_failure = 900 + delay_inc_div = 5 + + bandwidth = False # Turns metrics bandwidth metrics collection on / off + bandwidth_test_interval = 600 # Interval for colllecting bandwidth metrics + minimal_collect_interval = 5 # Minimal metric collection interval + + verbose_mode = False # Set it on for troubleshooting + + fetch_routers_in_parallel = False # Set to True if you want to fetch multiple routers parallel + max_worker_threads = 5 # Max number of worker threads that can fetch routers (parallel fetch only) + max_scrape_duration = 10 # Max duration of individual routers' metrics collection (parallel fetch only) + total_max_scrape_duration = 30 # Max overall duration of all metrics collection (parallel fetch only) + mktxp.conf: | + ## Source: https://github.com/akpw/mktxp/blob/main/mktxp/cli/config/mktxp.conf + ## Copyright (c) 2020 Arseniy Kuznetsov + ## + ## This program is free software; you can redistribute it and/or + ## modify it under the terms of the GNU General Public License + ## as published by the Free Software Foundation; either version 2 + ## of the License, or (at your option) any later version. + ## + ## This program is distributed in the hope that it will be useful, + ## but WITHOUT ANY WARRANTY; without even the implied warranty of + ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ## GNU General Public License for more details. + + + [Sample-Router] + enabled = False # turns metrics collection for this RouterOS device on / off + + hostname = localhost # RouterOS IP address + port = 8728 # RouterOS IP Port + + username = username # RouterOS user, needs to have 'read' and 'api' permissions + password = password + + use_ssl = False # enables connection via API-SSL servis + no_ssl_certificate = False # enables API_SSL connect without router SSL certificate + ssl_certificate_verify = False # turns SSL certificate verification on / off + + installed_packages = True # Installed packages + dhcp = True # DHCP general metrics + dhcp_lease = True # DHCP lease metrics + + connections = True # IP connections metrics + connection_stats = False # Open IP connections metrics + + pool = True # Pool metrics + interface = True # Interfaces traffic metrics + + firewall = True # IPv4 Firewall rules traffic metrics + ipv6_firewall = False # IPv6 Firewall rules traffic metrics + ipv6_neighbor = False # Reachable IPv6 Neighbors + + poe = True # POE metrics + monitor = True # Interface monitor metrics + netwatch = True # Netwatch metrics + public_ip = True # Public IP metrics + route = True # Routes metrics + wireless = True # WLAN general metrics + wireless_clients = True # WLAN clients metrics + capsman = True # CAPsMAN general metrics + capsman_clients = True # CAPsMAN clients metrics + + kid_control_devices = False # Kid Control metrics + + user = True # Active Users metrics + queue = True # Queues metrics + + remote_dhcp_entry = None # An MKTXP entry for remote DHCP info resolution (capsman/wireless) + + use_comments_over_names = True # when available, forces using comments over the interfaces names + + check_for_updates = False # check for available ROS updates