From 6e1faf4a005a8ec9edd61260890499e207f0a70d Mon Sep 17 00:00:00 2001 From: thl-cmk <thl-cmk@outlook.com> Date: Mon, 23 Dec 2024 11:13:03 +0000 Subject: [PATCH] Add new file --- HOWTO.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 HOWTO.md diff --git a/HOWTO.md b/HOWTO.md new file mode 100644 index 0000000..dffea2a --- /dev/null +++ b/HOWTO.md @@ -0,0 +1,82 @@ +### How to + +1. create credentials for the Cisco Suport API [Cisco Support APIs](https://apiconsole.cisco.com/supportapis) via the [Cisco API Console](https://apiconsole.cisco.com/) +1. add these credentials to the Cisco LifeCycle config file `~/etc/ciscoapi/ciscoapi.json` +1. add a cronjob for the background plugins to fetch the data from the Cisco database +1. let the HW/SW inventory pick up the data + +## CISCO Support APIs/Cisco API Console +You need to have access to the [Cisco Support APIs](https://apiconsole.cisco.com/supportapis) via the [Cisco API Console](https://apiconsole.cisco.com/). There you need to create credentials for the plugin to work. These credentials need to have access to + +- **Bug API** +- **EoX API** +- **Product Information API** +- **Serial Number to Information API** +- **Software Suggestion API** +- **PSIRT API** + +## Adjust the Cisco LifeCycle config file + +If you have your credentials you need to adjust the config file for the Lifecycle plugin. + +``` +~/etc/ciscoapi/ciscoapi.json +{ + "global": { + "use_system_proxies": false, + "wait_after_start": false, + "max_wait_time": 15, + "log_level": "debug", + "base_dir": "~/var/ciscoapi" + }, + "eox": { + "refresh_known": 31, + "refresh_unknown": 7 + }, + "sn2info": { + "refresh_covered": 31, + "refresh_not_covered": 7 + }, + "psirt": { + "refresh_found": 1, + "refresh_not_found": 1 + }, + "suggestion": { + "refresh_found": 31, + "refresh_not_found": 7 + }, + "bug": { + "refresh_found": 7, + "refresh_not_found": 1 + }, + "cisco_api": { + "client_id": "<your_client_id>", + "client_secret": "<your_client_secret>", + "use_auth_proxy": false, + "auth_proxy_url": "", + "client_fqdn": "", + "root_cert": true + }, + "productinfo": { + "productseriesfile": "~/var/ciscoapi/productinfo" + } +} +``` + +## Create a cronjob for the background tools + +Last step is to create a cron job for the plugin to fetch the data from the Cisco database. I tend to let it run every hour. + +``` +~/etc$ cat ~/etc/cron.d/cisco_api_support +0 * * * * $OMD_ROOT/local/bin/ciscoapi/cisco-eox.py +15 * * * * $OMD_ROOT/local/bin/ciscoapi/cisco-sn2info.py +30 * * * * $OMD_ROOT/local/bin/ciscoapi/cisco-psirt.py +45 * * * * $OMD_ROOT/local/bin/ciscoapi/cisco-bug.py +``` +Don't forget to restart the cmk crond +``` +omd restart crontab crontab +``` + +## Now wait for the background plugins to fetch the data, if the have, the cmk inventory plugins will pick them up in the next cycle. -- GitLab