# Syed Jahanzaib Personal Blog to Share Knowledge !

## December 8, 2016

### Plotting Negative Value in rrdtool graph

Filed under: Linux Related — Tags: , — Syed Jahanzaib / Pinochio~:) @ 3:30 PM

Recently I was configuring an mrtg/rrd graph Where I had to display negative value as well along with others, but as per my findings mrtg/rrd graph doesn’t allow plotting Negative value. Let’s say we want to plot the temperature where we get both plus and negative values at different time of the day/night.

To do so, we have to tune the required rrd file to allow such storing.

Example: we have test.rrd file.
First get info by rrdtool

`rrdtool info test.rrd |grep ds`

you may see following

```rrdtool info test.rrd |grep ds
ds[ds0].index = 0
ds[ds0].type = "GAUGE"
ds[ds0].minimal_heartbeat = 600
ds[ds0].min = 0.0000000000e+00
ds[ds0].max = 1.0000000000e+02
ds[ds0].last_ds = "0"
ds[ds0].value = 0.0000000000e+00
ds[ds0].unknown_sec = 0
ds[ds1].index = 1
ds[ds1].type = "GAUGE"
ds[ds1].minimal_heartbeat = 600
ds[ds1].min = 0.0000000000e+00
ds[ds1].max = 1.0000000000e+02
ds[ds1].last_ds = "0"
ds[ds1].value = 0.0000000000e+00
ds[ds1].unknown_sec = 0```

now modify it by

`rrdtool tune test.rrd --minimum ds0:-100`

Now query rrdtool info again

```rrdtool info test.rrd |grep ds
ds[ds0].index = 0
ds[ds0].type = "GAUGE"
ds[ds0].minimal_heartbeat = 600
ds[ds0].min = -1.0000000000e+02
ds[ds0].max = 1.0000000000e+02
ds[ds0].last_ds = "0"
ds[ds0].value = 0.0000000000e+00
ds[ds0].unknown_sec = 0
ds[ds1].index = 1
ds[ds1].type = "GAUGE"
ds[ds1].minimal_heartbeat = 600
ds[ds1].min = 0.0000000000e+00
ds[ds1].max = 1.0000000000e+02
ds[ds1].last_ds = "0"
ds[ds1].value = 0.0000000000e+00
ds[ds1].unknown_sec = 0```

You will see the difference in ds[ds0].min value. Now we are good to go with negative plotting.

An example on how to plot negative values. Regard’s
Syed Jahanzaib
{"ft_lang_label":"__label__en","ft_lang_prob":0.68103313,"math_prob":0.9947319,"size":1672,"snap":"2022-40-2023-06","text_gpt3_token_len":634,"char_repetition_ratio":0.23920864,"word_repetition_ratio":0.3803419,"special_character_ratio":0.39832535,"punctuation_ratio":0.16531165,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98562944,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-09-24T20:46:21Z\",\"WARC-Record-ID\":\"<urn:uuid:4a634f96-f3f2-4012-be39-9fa8400cacc2>\",\"Content-Length\":\"106377\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:976e1409-cebe-4c9d-b904-1d2849c48203>\",\"WARC-Concurrent-To\":\"<urn:uuid:8015809d-552d-48c0-996a-c326fb74d3b9>\",\"WARC-IP-Address\":\"192.0.78.13\",\"WARC-Target-URI\":\"https://aacable.wordpress.com/2016/12/08/plotting-negative-value-in-rrdtool-graph/\",\"WARC-Payload-Digest\":\"sha1:DAWPN3JCKOSQYCFXOWUPVVSCBFCXS2C5\",\"WARC-Block-Digest\":\"sha1:7WTXFR7Y45NPPLP62DZILQLMPDRZIHK3\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030333455.97_warc_CC-MAIN-20220924182740-20220924212740-00323.warc.gz\"}"}