Commit 5c4f06a6 authored by Julius Metz's avatar Julius Metz

ordered yaxis

parent f38de2d9
...@@ -506,6 +506,7 @@ def make_plot(cmds_data, filter_info, cmd_color, plot_settings, plotly_format_va ...@@ -506,6 +506,7 @@ def make_plot(cmds_data, filter_info, cmd_color, plot_settings, plotly_format_va
dict -- with plotly jsons dict -- with plotly jsons
""" """
plot_data = [] plot_data = []
# make plotly plots config
for cmd in filter_info[needed_key]: for cmd in filter_info[needed_key]:
plot_data.append({ plot_data.append({
'x': [str(date) for date in cmds_data[cmd]['datetime']], 'x': [str(date) for date in cmds_data[cmd]['datetime']],
...@@ -667,11 +668,22 @@ def data_from_file(arguments): ...@@ -667,11 +668,22 @@ def data_from_file(arguments):
if line.startswith(b'# Host:'): if line.startswith(b'# Host:'):
host = re.search(r'# Host: *([^ ]+)', line.decode()).group(1) host = re.search(r'# Host: *([^ ]+)', line.decode()).group(1)
data, filter_data = parse_file(path, collectl, shorten_cmds, coarsest, config) data, filter_data = parse_file(path, collectl, shorten_cmds, coarsest, config)
filter_infos = None
if filtercmds: if filtercmds:
filter_infos = getattr(filter_func, filtertype)(filter_data, filtervalue) filter_infos = getattr(filter_func, filtertype)(filter_data, filtervalue)
else:
filter_infos = {key: list(data.keys()) for key in config['NEEDED_VALUES']}
return host, data, filter_infos # make new dict with sorted cmd from big to small
filter_infos_sorted = {}
for metric in config['NEEDED_VALUES']:
filter_infos_sorted[metric] = []
# go over all sorted commands and add if is not filtered out
for (cmd, _) in sorted(filter_data['commands'].items(), key=lambda x: x[1][metric], reverse=True):
if not filtercmds or cmd in filter_infos[metric]:
filter_infos_sorted[metric].append(cmd)
return host, data, filter_infos_sorted
@click.command(help='Generate htmlfiles with Plotlyplots with data from collectlfiles(".raw.gz")') @click.command(help='Generate htmlfiles with Plotlyplots with data from collectlfiles(".raw.gz")')
...@@ -720,7 +732,6 @@ def main(source, collectl, plotlypath, destination, configpath, ...@@ -720,7 +732,6 @@ def main(source, collectl, plotlypath, destination, configpath,
# validate config and make dict from values # validate config and make dict from values
config = {} config = {}
a = time.time()
for config_var_name, validator_dict in VALIDATIONS_INFOS.items(): for config_var_name, validator_dict in VALIDATIONS_INFOS.items():
try: try:
config[config_var_name] = getattr(config_module, config_var_name) config[config_var_name] = getattr(config_module, config_var_name)
......
...@@ -13,6 +13,11 @@ After that you can use it like that: ...@@ -13,6 +13,11 @@ After that you can use it like that:
``` ```
For informations of the options use "--help" or go to the [options](#options) description. For informations of the options use "--help" or go to the [options](#options) description.
## Collectl commad to make Datafiles
Important is "-sZ" with out Collectl2plotly can not get the data from the file for the plots
```
collectl -f <filename that will be created> -i <interval>:<interval> -sZ
```
## Options ## Options
...@@ -30,11 +35,6 @@ For informations of the options use "--help" or go to the [options](#options) de ...@@ -30,11 +35,6 @@ For informations of the options use "--help" or go to the [options](#options) de
| --filtervalue | any value (string, int, ...) | is passed to the filter function as string | - | | --filtervalue | any value (string, int, ...) | is passed to the filter function as string | - |
| --force | - | override existing plot directory if exist | - | | --force | - | override existing plot directory if exist | - |
### make collectl source files
Important is "-sZ" with out Collectl2plotly can not get the data from the file for the plots
```
collectl -f <filename that will be created> -i <interval> -sZ
```
## Config ## Config
The config is python file with following varibles to create spezial plots or/and with different values instead of the default. The config is python file with following varibles to create spezial plots or/and with different values instead of the default.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment