Skip to content
Analyse your phone's battery and energy consumption in zabbix
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Batman to Zabbix Converter

I was using Batman for a few days to track the battery life on my android phone. When i tried visualizing the information stored in those columns of text, it hit me: I already know something that is great at displaying stats: Zabbix. This will convert and send the data to your zabbix-server. If you like this script, let me know!


You need access to a server running zabbix. If you do not have one (or are capable of setting one up), this script is not for you. Sorry 'bout that.

Install Batman on your phone. Don't forget to actually start logging. I tend to forget to start logging after i reboot my phone.

The machine running the conversion needs Ruby 1.9 and a copy of the Zabbix-Agent.



Import the zabbix_host_import.xml on your zabbix server. This should generate a new host called "Your-Device" including some items and graphs. Rename it, if you like.


Have the correct zabbix_sender binary for your platform nearby. It can be either on your path, or you can just place it directly into this project's directory. You can download the Zabbix Sender as part of the Zabbix Agent or from your OS's package-manager.

Copy zabbix_sender.conf.example to zabbix_sender.conf. Alter its contents to point to your server and insert your hostname (if you changed it, see above).


You have two possibilities to run the converter/importer:

a) Place batman.csv into the project's directory and run batmanconvert.rb
b) Call batmanconvert.rb from a terminal and give it the csv's location as parameter like this: batmanconvert.rb test/batman.01.csv (in case you renamed it)

The program will produce two kinds of output: one is from the conversion (a bunch of timestamps), one is from zabbix_sender (a bunch of "info from server..." lines). A week of logging produces a 5MB CSV and a 28MB Tempfile. The import may take a few minutes.


This is not a huge script or anything out of the ordinary. If you must have a license: I'm triple-licensing it under the following licenses. Please pick the one that suits your needs.

You can’t perform that action at this time.