User Tools
toolsandtechnologies:grafanaandstaticfile
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| toolsandtechnologies:grafanaandstaticfile [2020/07/01 17:10] – ywang | toolsandtechnologies:grafanaandstaticfile [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Show Static File(Log) in Grafana ====== | ||
| + | |||
| + | |||
| + | Grafana cannot show static file(log file etc.) from the file system by native. The example we have currently is we are going to create status logs file for idmsscripts to show some basic info, like if the process running successful or failed. But there are some ways to do it. The way descript below will be using node_exporter to read the file content to show in Grafana. | ||
| + | |||
| + | * Make sure the permission of log directory and log file are all 755, also make sure the location of log directory is open for all the users/ | ||
| + | * Change your log file content format to satisfy node-exporter requirements(https:// | ||
| + | < | ||
| + | # HELP http_requests_total The total number of HTTP requests. | ||
| + | # TYPE http_requests_total counter | ||
| + | http_requests_total{method=" | ||
| + | http_requests_total{method=" | ||
| + | |||
| + | # Escaping in label values: | ||
| + | msdos_file_access_time_seconds{path=" | ||
| + | |||
| + | # Minimalistic line: | ||
| + | metric_without_timestamp_and_labels 12.47 | ||
| + | </ | ||
| + | * Restart/ | ||
| + | < | ||
| + | Restart: / | ||
| + | Re-install: ansible playbooks install-node-exporter.yml under prometheus-monitoring-config to install with cloudalchemy.node-exporter | ||
| + | Install Dependencies: | ||
| + | export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES | ||
| + | Change var: | ||
| + | Run: ansible-playbook -i ../ | ||
| + | More variables of cloudalchemy.node-exporter can be found at https:// | ||
| + | </ | ||
| + | * Access node_exporter of the env which hold the log file via url, like http:// | ||
| + | < | ||
| + | node_scrape_collector_success{collector=" | ||
| + | node_scrape_collector_duration_seconds{collector=" | ||
| + | |||
| + | # HELP node_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise | ||
| + | # TYPE node_textfile_scrape_error gauge | ||
| + | node_textfile_scrape_error 0 | ||
| + | </ | ||
| + | * Also, you should be able to see the your variables there as well | ||
| + | * Then, just create Grafana dashboard/ | ||
| + | |||