Hi all,
I get it that the masurement of metrics in a slice is done using the MFlib library. What I am unable to understand and to locate in the Fabric examples directory is how to get those values as strings or numbers inside variables. I would be highly obliged if someone could guide me in the right direction. Thank you!
There is a REST API that can be used to access the metrics programmatically in addition to the Grafana views. I will have to add the documentation for that. I’ll post back here once that is done.
Here are the instructions for getting metric data programmatically using curl.
Create a jupyter notebook with the following cells.
# Import MFLib Class
from mflib.mflib import MFLib
slice_name = “<your slice name>”
mf = MFLib(slice_name)
# Get the ht_user & ht_password for the slice’s meas_node.
data = {}
# Set the info you want to get.
data[“get”] = [“ht_user”, “ht_password”]
# Call info using data
info_results = mf.info(“prometheus”, data)
print(info_results)
Alternatively you can just add the second cell above to the existing prometheus_grafana.ipynb notebook.
Create a tunnel thru the bastion host for port 9090. This is similar to the tunnel needed for accessing grafana but using port 9090:localhost:9090 instead of 10010:localhost:443.
The above cell should print out the meas_node_ip as “Found meas node as meas-node at <your meas_node_ip>”
Then make API call using curl or python requests etc…
Here is a simple example using the ht_user and ht_password retrieved above to get the latest up metrics.
Registration for KNIT10 closes on **Friday, February 28 at 11:59 PM ET**. [>>>Register Now](https://apps2.research.unc.edu/events/index.cfm?event=events.go&key=C558)
Registration for KNIT10 closes on **Friday, February 28 at 11:59 PM ET**. [>>>Register Now](https://apps2.research.unc.edu/events/index.cfm?event=events.go&key=C558)