Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit 0649696e authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

Update README.md

parent c82afc03
No related branches found
No related tags found
No related merge requests found
......@@ -15,12 +15,12 @@ LLDP inventory-columns: `"system_name,local_port_num,port_id"`
Usage with CDP (this is the default):
```
~/local/lib/topology_data/create_topology_data.py -s CORE01 -m
~/local/lib/topology_data/create_topology_data.py -s Core01 -m
```
Usage with LLDP:
```
~/local/lib/topology_data/create_topology_data.py -s CORE01 -m --lldp
~/local/lib/topology_data/create_topology_data.py -s Core01 -m --lldp
```
......@@ -133,7 +133,7 @@ OMD[build]:~$
To make the topology created by this tool the default use the option `-m` / `--make-default`
```
$ ~/local/bin/topology_data/create_topology_data.py -s CORE01 -m
$ ~/local/bin/topology_data/create_topology_data.py -s Core01 -m
```
</details>
......@@ -141,11 +141,36 @@ $ ~/local/bin/topology_data/create_topology_data.py -s CORE01 -m
<details><summary>Can i automate the creation of the topology data</summary>
\
Yes. Add a cron job for the site user in `~etc/check_mk/conf.d/`. The tool can than run in regular intervals. By default it will only create a new topology if the new topology differs from the default topology. So by running
Yes. Add a cron job for the site user in `~/etc/cron.d`. I.e. to create a topology every hour create the file `create_topoloky_data` in `~/etc/cron.d`
```
0 * * * * $OMD_ROOT/local/bin/topology_data/create_topology_data.py -s C9540-7-1 -m --keep-max 10 --keep-max 10 --min-age 14
```
This will run the tool every hour and create a new topology if there was a changee. It keeps 10 topologies and deletes old topologies only if they are older than 14 days.
Don't forget to restart the crontab service after creating the cron job.
```
OMD[build]:~/etc/cron.d$ omd restart crontab
Temporary filesystem already mounted
Removing Crontab...OK
Initializing Crontab...OK
OMD[build]:~/etc/cron.d$
```
$ ~/local/bin/topology_data/create_topology_data.py -s CORE01 -m
With crontab -l you get the list of active cron jobs
```
OMD[build]:~/etc/cron.d$ crontab -l | grep -A 3 -B 1 create_topoloky_data
# ------------------------------------------------------------
# /omd/sites/build/etc/cron.d/create_topoloky_data
0 * * * * $OMD_ROOT/local/bin/topology_data/create_topology_data.py -s Core01 -m --keep-max 10
# ------------------------------------------------------------
```
you get each time a new default topology if ther was a change. The name for the new topology is by default the creation date and time.
**Note**: By default it will only create a new topology if the new topology differs from the default topology. The name for the new topology is by default the creation date and time.
</details>
......@@ -155,7 +180,7 @@ you get each time a new default topology if ther was a change. The name for the
Yes. If you use the option --keep-max <number of topologies to keep> the tool will delete all topologies over this number. I.e.
```
$ ~/local/bin/topology_data/create_topology_data.py -s CORE01 --keep-max 10
$ ~/local/bin/topology_data/create_topology_data.py -s Core01 --keep-max 10
```
will delete the oldest topologies until there only 10 topologies left.
......@@ -166,11 +191,9 @@ will delete the oldest topologies until there only 10 topologies left.
<details><summary>I will not delete topologies from the last X days</summary>
No problem. Just use the option `--min-age` togeher with `--keep-max`. I.e.
```
$ ~/local/bin/topology_data/create_topology_data.py -s CORE01 --keep-max 10 --min-age 30
$ ~/local/bin/topology_data/create_topology_data.py -s Core01 --keep-max 10 --min-age 30
```
will only delete a topology if it older than 30 days.
**Note**: the minimum value for `--min-age` is _1_ day.
......@@ -252,7 +275,7 @@ Wehre `-p` is the path to your inventory data and `-c` are the columns used in t
Sample output
```
OMD[build]:~$ ~/local/bin/topology_data/create_topology_data.py -s CORE01
OMD[build]:~$ ~/local/bin/topology_data/create_topology_data.py -s Core01
Start time: 2023-10-16T21:44:53.10
Devices added: 66, source inv_CDP
time taken: 1.035935568/s
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment