mirror of
				https://github.com/KevinMidboe/mktxp-no-cli.git
				synced 2025-10-29 17:50:23 +00:00 
			
		
		
		
	Update README.md
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							cd95a95c67
						
					
				
				
					commit
					d9009f7799
				
			
							
								
								
									
										171
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										171
									
								
								README.md
									
									
									
									
									
								
							@@ -228,6 +228,91 @@ mktxp edit -i
 | 
			
		||||
Now with your RouterOS metrics being exported to Prometheus, it's easy to visualize them with this [Grafana dashboard](https://grafana.com/grafana/dashboards/13679)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Description of CLI Commands
 | 
			
		||||
### mktxp commands
 | 
			
		||||
       . MKTXP commands:
 | 
			
		||||
        .. info     Shows base MKTXP info
 | 
			
		||||
        .. edit     Open MKTXP configuration file in your editor of choice        
 | 
			
		||||
        .. print    Displays selected metrics on the command line
 | 
			
		||||
        .. export   Starts collecting metrics for all enabled RouterOS configuration entries
 | 
			
		||||
        .. show   	Shows MKTXP configuration entries on the command line
 | 
			
		||||
 | 
			
		||||
````
 | 
			
		||||
❯ mktxp -h
 | 
			
		||||
usage: MKTXP [-h] [--cfg-dir CFG_DIR] {info, edit, export, print, show, } ...
 | 
			
		||||
 | 
			
		||||
Prometheus Exporter for Mikrotik RouterOS
 | 
			
		||||
 | 
			
		||||
optional arguments:
 | 
			
		||||
  -h, --help            show this help message and exit
 | 
			
		||||
  --cfg-dir CFG_DIR     MKTXP config files directory (optional)
 | 
			
		||||
````
 | 
			
		||||
To learn more about individual commands, just run it with ```-h```:
 | 
			
		||||
For example, to learn everything about ````mktxp show````:
 | 
			
		||||
````
 | 
			
		||||
❯ mktxp show -h
 | 
			
		||||
usage: MKTXP show [-h]
 | 
			
		||||
                  [-en ['Sample-Router']]
 | 
			
		||||
                  [-cfg]
 | 
			
		||||
Displays MKTXP config router entries
 | 
			
		||||
optional arguments:
 | 
			
		||||
  -h, --help            show this help message and exit
 | 
			
		||||
  -en, --entry-name ['Sample-Router']
 | 
			
		||||
                        Config entry name
 | 
			
		||||
  -cfg, --config        Shows MKTXP config files paths
 | 
			
		||||
````  
 | 
			
		||||
 | 
			
		||||
## Advanced features
 | 
			
		||||
While most of the [mktxp options](https://github.com/akpw/mktxp#getting-started) are self explanatory, some might require a bit of a context.
 | 
			
		||||
 | 
			
		||||
### Remote DHCP resolution
 | 
			
		||||
When gathering various IP address-related metrics, mktxp automatically resolves IP addresses whenever DHCP info is available. In many cases however, the exported devices does not have this information locally and instead rely on central DHCP servers. Since this could reduce readibility / usefulness of the metrics, mktxp supports remote DHCP server calls via the following option:
 | 
			
		||||
```
 | 
			
		||||
remote_dhcp_entry = None        # An MKTXP entry for remote DHCP info resolution in capsman/wireless
 | 
			
		||||
```
 | 
			
		||||
`MKTXP entry` in this context can be any other mktxp.conf entry, and for the sole purpose of providing DHCP info it does not even need to be enabled. 
 | 
			
		||||
 | 
			
		||||
### Connections stats
 | 
			
		||||
With many connected devices everywhere, one can often only guess where do they go to and what they actually do with all the information from your network environment. MKTXP let's you easily track those with a single option, with results available both from [mktxp dashboard](https://grafana.com/grafana/dashboards/13679-mikrotik-mktxp-exporter/) and the command line:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
connection_stats = False        # Open IP connections metrics 
 | 
			
		||||
```
 | 
			
		||||
Setting this to `True` obviously enables the feature and allows to see something like that:
 | 
			
		||||
 | 
			
		||||
<img width="2346" alt="conns" src="https://user-images.githubusercontent.com/5028474/217042107-bffa0a81-a6a0-4474-87d4-1597cdd80735.png">
 | 
			
		||||
 | 
			
		||||
*Hey, what is this Temp&Humidity sensor has to do with a bunch of open network connections? 12 of them, really?*
 | 
			
		||||
*Let's go check on that in the dashboard, or just get the info right from the command line:*
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
❯ mktxp print -en MKT-GT -cn
 | 
			
		||||
+-------------------+--------------+------------------+-----------------------------------------------------------------------+
 | 
			
		||||
|     dhcp_name     | src_address  | connection_count |                             dst_addresses                             |
 | 
			
		||||
+===================+==============+==================+=======================================================================+
 | 
			
		||||
| T&H Cat's Room    | 10.20.10.149 |        12        |          3.124.97.151:32100(udp), 13.38.179.104:32100(udp),           |
 | 
			
		||||
|                   |              |                  |                       54.254.90.185:32100(udp)
 | 
			
		||||
```
 | 
			
		||||
*A quick `whois` check shows all of the external IPs relate to AWS, so supposedly it's legit... but let's remain vigilant, to know better :)*
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Parallel routers fetch
 | 
			
		||||
Concurrent exports across multiple devices can considerably speed up things for slow network connections. This feature can be turned on and configured with the following [system options](https://github.com/akpw/mktxp/blob/main/README.md#mktxp-system-configuration):
 | 
			
		||||
```
 | 
			
		||||
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)
 | 
			
		||||
```
 | 
			
		||||
To keeps things within expected boundaries, the last two parameters allows for controlling both individual and overall scrape durations
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### mktxp port
 | 
			
		||||
By default, mktxp runs it's HTTP metrics endpoint on port 49090. You can change it via the following [system option](https://github.com/akpw/mktxp/blob/main/README.md#mktxp-system-configuration):
 | 
			
		||||
```
 | 
			
		||||
port = 49090 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Setting up MKTXP to run as a Linux Service
 | 
			
		||||
If you've installed MKTXP on a Linux system, you can run it with system boot via adding a service. \
 | 
			
		||||
Let's start with:
 | 
			
		||||
@@ -323,92 +408,6 @@ Let's save and then start the service as well as check on its' status:
 | 
			
		||||
mktxp is running as pid 36704
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Description of CLI Commands
 | 
			
		||||
### mktxp commands
 | 
			
		||||
       . MKTXP commands:
 | 
			
		||||
        .. info     Shows base MKTXP info
 | 
			
		||||
        .. edit     Open MKTXP configuration file in your editor of choice        
 | 
			
		||||
        .. print    Displays selected metrics on the command line
 | 
			
		||||
        .. export   Starts collecting metrics for all enabled RouterOS configuration entries
 | 
			
		||||
        .. show   	Shows MKTXP configuration entries on the command line
 | 
			
		||||
 | 
			
		||||
````
 | 
			
		||||
❯ mktxp -h
 | 
			
		||||
usage: MKTXP [-h] [--cfg-dir CFG_DIR] {info, edit, export, print, show, } ...
 | 
			
		||||
 | 
			
		||||
Prometheus Exporter for Mikrotik RouterOS
 | 
			
		||||
 | 
			
		||||
optional arguments:
 | 
			
		||||
  -h, --help            show this help message and exit
 | 
			
		||||
  --cfg-dir CFG_DIR     MKTXP config files directory (optional)
 | 
			
		||||
````
 | 
			
		||||
To learn more about individual commands, just run it with ```-h```:
 | 
			
		||||
For example, to learn everything about ````mktxp show````:
 | 
			
		||||
````
 | 
			
		||||
❯ mktxp show -h
 | 
			
		||||
usage: MKTXP show [-h]
 | 
			
		||||
                  [-en ['Sample-Router']]
 | 
			
		||||
                  [-cfg]
 | 
			
		||||
Displays MKTXP config router entries
 | 
			
		||||
optional arguments:
 | 
			
		||||
  -h, --help            show this help message and exit
 | 
			
		||||
  -en, --entry-name ['Sample-Router']
 | 
			
		||||
                        Config entry name
 | 
			
		||||
  -cfg, --config        Shows MKTXP config files paths
 | 
			
		||||
````  
 | 
			
		||||
 | 
			
		||||
## Advanced features
 | 
			
		||||
While most of the [mktxp options](https://github.com/akpw/mktxp#getting-started) are self explanatory, some might require a bit of a context.
 | 
			
		||||
 | 
			
		||||
### Remote DHCP resolution
 | 
			
		||||
When gathering various IP address-related metrics, mktxp automatically resolves IP addresses whenever DHCP info is available. In many cases however, the exported devices does not have this information locally and instead rely on central DHCP servers. Since this could reduce readibility / usefulness of the metrics, mktxp supports remote DHCP server calls via the following option:
 | 
			
		||||
```
 | 
			
		||||
remote_dhcp_entry = None        # An MKTXP entry for remote DHCP info resolution in capsman/wireless
 | 
			
		||||
```
 | 
			
		||||
`MKTXP entry` in this context can be any other mktxp.conf entry, and for the sole purpose of providing DHCP info it does not even need to be enabled. 
 | 
			
		||||
 | 
			
		||||
### Connections stats
 | 
			
		||||
With many connected devices everywhere, one can often only guess where do they go to and what they actually do with all the information from your network environment. MKTXP let's you easily track those with a single option, with results available both from [mktxp dashboard](https://grafana.com/grafana/dashboards/13679-mikrotik-mktxp-exporter/) and the command line:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
connection_stats = False        # Open IP connections metrics 
 | 
			
		||||
```
 | 
			
		||||
Setting this to `True` obviously enables the feature and allows to see something like that:
 | 
			
		||||
 | 
			
		||||
<img width="2346" alt="conns" src="https://user-images.githubusercontent.com/5028474/217042107-bffa0a81-a6a0-4474-87d4-1597cdd80735.png">
 | 
			
		||||
 | 
			
		||||
*Hey, what is this Temp&Humidity sensor has to do with a bunch of open network connections? 12 of them, really?*
 | 
			
		||||
*Let's go check on that in the dashboard, or just get the info right from the command line:*
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
❯ mktxp print -en MKT-GT -cn
 | 
			
		||||
+-------------------+--------------+------------------+-----------------------------------------------------------------------+
 | 
			
		||||
|     dhcp_name     | src_address  | connection_count |                             dst_addresses                             |
 | 
			
		||||
+===================+==============+==================+=======================================================================+
 | 
			
		||||
| T&H Cat's Room    | 10.20.10.149 |        12        |          3.124.97.151:32100(udp), 13.38.179.104:32100(udp),           |
 | 
			
		||||
|                   |              |                  |                       54.254.90.185:32100(udp)
 | 
			
		||||
```
 | 
			
		||||
*A quick `whois` check shows all of the external IPs relate to AWS, so supposedly it's legit... but let's remain vigilant, to know better :)*
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Parallel routers fetch
 | 
			
		||||
Concurrent exports across multiple devices can considerably speed up things for slow network connections. This feature can be turned on and configured with the following [system options](https://github.com/akpw/mktxp/blob/main/README.md#mktxp-system-configuration):
 | 
			
		||||
```
 | 
			
		||||
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)
 | 
			
		||||
```
 | 
			
		||||
To keeps things within expected boundaries, the last two parameters allows for controlling both individual and overall scrape durations
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### mktxp port
 | 
			
		||||
By default, mktxp runs it's HTTP metrics endpoint on port 49090. You can change it via the following [system option](https://github.com/akpw/mktxp/blob/main/README.md#mktxp-system-configuration):
 | 
			
		||||
```
 | 
			
		||||
port = 49090 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Installing Development version
 | 
			
		||||
- Clone the repo, then run: `$ python setup.py develop`
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user