# CpuFreq graph error

**URL:** <https://community.ipfire.org/t/cpufreq-graph-error/8246>\
**Category:** Installing & Running IPFire\
**Created:** [16 July 2022 18:07 UTC](https://community.ipfire.org/t/cpufreq-graph-error/8246 "2022-07-16T18:07:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [16 July 2022 18:07 UTC](https://community.ipfire.org/t/cpufreq-graph-error/8246/1 "2022-07-16T18:07:45Z")

</div>

I’ve read through the other threads on this and don’t really see a solution for this.

```auto
,"LINE1:cpu".$i.$color{"color1$j"}."A0:cpu ".$i." "

```

gives me this error:

 ![graph1](https://community.ipfire.org/uploads/default/original/2X/a/add4b7d5885d282e2cd7c404cc6b55f3242e8d91.png)

I played around a little and I can get 16 out of 20 Cpu’s (threading is turned off so not showing 40) to show up using

```auto
,"LINE1:cpu".$i.random_hex_color(6)."A0:cpu".$i." "

```

 ![graph2](https://community.ipfire.org/uploads/default/original/2X/1/1b28a8cc3446e669581ca60c2947ac5374874758.png)

what would I change to permanently fix the graph?

my hardware is:  
[FireInfo](https://fireinfo.ipfire.org/profile/b4f17737982bba87b314c375278554dcdda3d54e)

---

<div class="post-metadata">

**Author:** ![bonnietwin](https://community.ipfire.org/user_avatar/community.ipfire.org/bonnietwin/32/12350_2.png) [@bonnietwin](https://community.ipfire.org/u/bonnietwin)\
**Post date:** [16 July 2022 21:11 UTC](https://community.ipfire.org/t/cpufreq-graph-error/8246/2 "2022-07-16T21:11:09Z")

</div>

Bug has already been raised for this.

[https://bugzilla.ipfire.org/show\_bug.cgi?id=12890](https://bugzilla.ipfire.org/show_bug.cgi?id=12890)

---

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [2 August 2022 15:38 UTC](https://community.ipfire.org/t/cpufreq-graph-error/8246/3 "2022-08-02T15:38:45Z")

</div>

for a temporary fix i added a break in the cpufreq graph until an actual fix is released, i only need a few cpu’s to see whats going on.

```auto
	for(my $i = 0; $i < $cpucount; $i++) {
		my $j=$i+1;
		   if ($i == 9) {
		      last;
		   }

		push(@command,"DEF:cpu".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpufreq/cpufreq-".$i.".rrd:value:AVERAGE"
				,"CDEF:cpu".$i."=cpu".$i."_,1000000,/"
				,"LINE1:cpu".$i.$color{"color1$j"}."A0:cpu ".$i." "

```

 ![graph4](https://community.ipfire.org/uploads/default/original/2X/4/44c017076cba77921e8ae2c24acad5afff8f272a.jpeg)

---

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [12 February 2023 17:49 UTC](https://community.ipfire.org/t/cpufreq-graph-error/8246/4 "2023-02-12T17:49:07Z")

</div>

Ok so i had some time to play with this again and ive found that if you modify line 1104 in graphs.pl

```auto
,"LINE1:cpu".$i.$color{"color1$j"}."A0:cpu ".$i." "

```

to

```auto
,"LINE1:cpu".$i.$color{"color$j"}."A0:cpu ".$i." "

```

colors.txt starts at 1 and goes through 25 so if you have color1$j then your starting at 10 i believe.

with the change you willl no longer get the dreaded “cpu9A0 is not a vname nor a number msg”

also for people with more then 8 cores you can change line 1083

```auto
		@GRAPH_ARGS,

```

to

```auto
	"--imgformat", "SVG",
	# No border
	"--border", "0",
	# For a more 'organic' look
	"--slope-mode",
	# HxW define the size of the output image
	"--full-size-mode",
	# Watermark
	"-W www.ipfire.org",
	# Default size
	"-w 910",
	"-h 600",
	# Use alternative grid
	"--alt-y-grid",

```

so the graph for only that metric will be resized and show the graph also

 ![resized](https://community.ipfire.org/uploads/default/original/2X/0/0bf7983f49de80c1add4ca226910fe143ed49e2c.png)

the entirety of that section of code is

```auto
sub updatecpufreqgraph {
	my $cpucount = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/cpu-*/ 2>/dev/null | wc -l`;
	my $period = $_[0];
	my @command = (
	"--imgformat", "SVG",
	# No border
	"--border", "0",
	# For a more 'organic' look
	"--slope-mode",
	# HxW define the size of the output image
	"--full-size-mode",
	# Watermark
	"-W www.ipfire.org",
	# Default size
	"-w 910",
	"-h 600",
	# Use alternative grid
	"--alt-y-grid",
		"-",
		"--start",
		"-1".$period,
		"-r",
		"-t ".$Lang::tr{'cpu frequency per'}." ".$Lang::tr{$period."-graph"},
		"-v MHz",
		"--color=SHADEA".$color{"color19"},
		"--color=SHADEB".$color{"color19"},
		"--color=BACK".$color{"color21"},
		"COMMENT:".sprintf("%-10s",$Lang::tr{'caption'}),
		"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
		"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
		"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
		"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"
	);

	for(my $i = 0; $i < $cpucount; $i++) {
		my $j=$i+1;
		push(@command,"DEF:cpu".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpufreq/cpufreq-".$i.".rrd:value:AVERAGE"
				,"CDEF:cpu".$i."=cpu".$i."_,1000000,/"
				,"LINE1:cpu".$i.$color{"color$j"}."A0:cpu ".$i." "
				,"GPRINT:cpu".$i.":MAX:%3.0lf Mhz"
				,"GPRINT:cpu".$i.":AVERAGE:%3.0lf Mhz"
				,"GPRINT:cpu".$i.":MIN:%3.0lf Mhz"
				,"GPRINT:cpu".$i.":LAST:%3.0lf Mhz\\j");
	}

	RRDs::graph (@command);
	$ERROR = RRDs::error;
	return "Error in RRD::graph for cpu freq: ".$ERROR."\n" if $ERROR;
}

```

This sizing edit will also work for the HWTempgraph on line 859

 ![HWG](https://community.ipfire.org/uploads/default/original/2X/5/5d03d2073dcd728e51b655afd3bc73c1536cc57e.png)

I haven’t found a way as of yet to auto-size the graphs per the data they need to show, but for now this works
