go-graphite / go-carbon

Golang implementation of Graphite/Carbon server with classic architecture: Agent -> Cache -> Persister
MIT License
805 stars 123 forks source link

[Q] ; 'bad pickle message' in go-carbon.log #430

Open frankdurv opened 3 years ago

frankdurv commented 3 years ago

I replaced carbon-cache by go-carbon (version 0.15.6) Data comes from a Nagios server. With carbon-cache was working fine. go-carbon is giving "bad pickle message", for all data coming from Nagios.

I get messages like this in the go-carbon.log file: [2021-09-14T09:24:44.888+0200] INFO [pickle] can't parse message {"data": … S'ims.1360com.t1c-com-1-1.load.load1'\n(S'1631604224'\np154\nS'0.100'\np155\nttp156\na(S'ims.1360com.t1c-com-1-1.load.load5'\n(g154\nS'0.180'\np157\nttp158\na(S'ims.1360com.t1c-com-1-1.load.load15'\n(g154\nS'0.240'\np159\nttp160\na … (S'ims.broadworks.ipcas.t1b-ipcas-5-2.SignalDelay.Sip_Answer_Max'\np233\n(g221\nS''\nttp234\na.", "error": "bad pickle message"}

Any idea what could be wrong here?

deniszh commented 3 years ago

Hi @frankdurv

That's strange, after https://github.com/go-graphite/go-carbon/pull/340 go-carbon should parse pickle for Python versions 2.x and 3.x (protocols 2,3,4,5). Which graphite and python version do you using?

frankdurv commented 3 years ago

Hi Denis,

Thanks for the reply. The versions are the following Python 2.7.5 Graphite 1.1.2 Server is redhat 7

Met vriendelijke groet/Kind regards,

Frank Durville

zerosoul13 commented 2 years ago

@frankdurv This normally happens when pickle.dumps does not specify a protocol. How are you sending the data from Nagios to Graphite?

Graphite documentation shows the following example to send Pickle format to Graphite:

payload = pickle.dumps(listOfMetricTuples, protocol=2)
header = struct.pack("!L", len(payload))
message = header + payload

Just for kicks I looked up a Nagios/Graphite integration and came across Graphios repository. The code does not specify the protocol

# procotol not specified in `pickle.dumps` call
payload = pickle.dumps(metric_list_chunk) 
header = struct.pack("!L", len(payload))
message = header + payload
messages.append(message)

This could be your case or not. Wanted to share an example to illustrate the possible root cause.