I recently had a co-worker come to me to voice a frustration. This was one of those “there has to be an easier way to do this!” type of issue. The frustration revolved around managing Cisco Telepresence units. They were tired of having to log in to each codec’s WebGUI to find out that a camera was disconnected or that it was experiencing high latency. They wanted an easier way to see all the diagnostic messages in a centralized place. Best yet they wanted it for FREE!

So baring them providing a new budget to go out and purchasing something like Cisco TelePresence Management Suite (TMS), I was left developing something on my own. Here’s what I came up with!

Requirements:

Optional:

Setting these up are out of scope for this story, however I linked the guides that I used to install the above. There are also guides for Dockerized versions if you search on Google.

I listed LibreNMS as optional for this story. We were already using it internally and it was a convenient way to have codecs register to automatically via SNMP (LibreNMS can listen to network subnets and auto add devices with valid community strings). Once in LibreNMS, I could use their API to get the hostnames for all our codecs so I could run a Python script against them. Alternatively you can also just store your codecs in a JSON file and have the script read them from there.

Now that the requirements are out of the way 😜, let’s move on to the python script. You can view it up on my GitHub. To install on your Ubuntu server run the following:



$ git clone $ cd /opt/my_project$ git clone https://github.com/sieteunoseis/codec_influxdb_grafana.git

You’ll have to update main.py to include your LibreNMS hostname, API key and InfluxDB hostname. In the /codecs/actions.py file you’ll need to add the username and password to log into your codecs. You could also make these environmental variables if you don’t want to hardcode them in the file like I did.

Once you have the python script installed, I recommend creating a Systemd Unit file to run the python script in the background.

$ sudo touch /lib/systemd/system/codec.service

$ sudo nano /lib/systemd/system/codec.service

Paste in the following:

[Unit]

Description=Python service to pull data from Cisco codecs [Install]

WantedBy=multi-user.target [Service]

User=<INSERT USERNAME>

PermissionsStartOnly=true

ExecStart=/usr/bin/nice /usr/bin/python3 /opt/my_project/ main.py

TimeoutSec=600

Restart=on-failure

RuntimeDirectoryMode=755

You can start/stop/check/enable your service with the following commands:

$ sudo systemctl start codec.service

$ sudo systemctl stop codec.service

$ sudo systemctl status codec.service

$ sudo systemctl enable codec.service

The python script will collect data from your codecs in 6 minute intervals (you can adjust this on line 134 in main.py) and then store in your InfluxDB database named codecs. Once your database is populated you can then use Grafana to create any number of dashboard to display your data! Here are some screenshots of dashboards that I created:

Grafana dashboard for Cisco Telepresence Codecs

Packet Loss (I added up all the loss then divided by the total packets and multiplied by 100)

Software Version — Pie chart of all the different OS our codecs are running

Current Connected Calls — Count of active calls retrieved during last poll (Note: this is not a live metric)

People Count — Count of people in rooms detected by codec. This requires additional licensing. (Note: this is not a live metric)

Snapshot — NodeJS app to retrieve snapshot from codec. I will be posting this code in another story.

Status Map — Used a plugin I found on this article to visualize status over time

Grafana table displaying diagnostic messages from Cisco Telepresence Codecs

Diagnostics Message Table — Co-workers original request! Displays all the messages for all codecs in an easy to read table

Displays all the messages for all codecs in an easy to read table Inventory Table — Table displaying basic info for each codec with links to each WebGUI

Grafana has a pretty intuitive query builder to help you build all sorts of visualizations. Once you come up with the correct query via the Explore option, you should be able to paste into a visualization. Here is a sample query I used for Software versions:

SELECT COUNT(“Status. @version ”) FROM codec_stats where $timeFilter GROUP BY os

If you run into any issues leave a comment and I’ll try to help out!