latest entries
I've spent the past few weeks working on a decent-sized project called ZMonitor to help at my current job. It is basically a client I developed in Ruby to show the Zabbix dashboard in a terminal, since there wasn't one available previously (other than this perl+curl mashup my workplace was using).
The main application basically calls the API twice through JSON calls to gather all of the information it needs, and then generates an array of strings and prints them at the end. There is an option to hide events that are in maintenance mode, which can help a lot from spamming you with an unusable list.
The acknowledgement function can accept most regular expressions to allow for mass acknowledgement (however, no wildcards since those can be abused too easily).
There are several TODOs for this application already, too, that I might not get to complete anytime soon. The major one is to use ncurses for rendering the dashboard, and quite a bit of functionality will come with that (such as acknowledging from the dashboard, and maybe interactive filtering). Additional functions for showing the history of a server is also planned, and a calibration function to determine time differences between the local computer and Zabbix master.
1.0.9.pre is for the most part very usable now. I personally think some of the code is a bit ugly since I'm not superb at Ruby yet, so all input is welcome. The whole application is also pretty colourful, don't you think?
So, it's come to the point where my laptop has unexpectedly turned off from a dead battery one too many times, so I decided to write a battery widget using Vicious for the window manager I'm using, Awesome. The configuration files are all written in Lua, and honestly I've never touched Lua or felt like programming in it since it looks so...confuzzling.
Nevertheless, I took a look at the Vicious and Naughty libraries, and some Lua documentation to get this up and running:
batmon = awful.widget.progressbar()
batmon:set_width(8)
batmon:set_vertical(true)
batmon:set_border_color("#3f3f3f")
batmon:set_color("#5f5f5f")
batmon_t = awful.tooltip({ objects = { batmon.widget },})
vicious.register(batmon, vicious.widgets.bat, function (widget, args)
batmon_t:set_text(" State: " .. args[1] .. " | Charge: " .. args[2] .. "% | Remaining: " .. args[3])
if args[2] <= 5 then
naughty.notify({ text="Battery is low! " .. args[2] .. " percent remaining." })
end
return args[2]
end , 60, "BAT0")
What this basically does is create a progressbar widget with the Awful library, configure its settings, create a tooltip with detailed information, and registers the widget I created with Vicious. The Vicious portion of it uses the battery widget type and sets a timer to update it every 60 seconds, which updates the progressbar percentage and the tooltip. It also checks for a low battery, which for me pops up a little box at the upper right of my screen.
I'm probably not going to be touching Lua for a while again.
For now I have *.milkteafuzz.com and *.teppel.in currently pointing to the same server and document root. Anyone who's visiting for anime.milkteafuzz.com or some other service I previously had on my other servers should expect to see those come back up in the coming weeks (possibly this weekend) while I spent some time toying around with nginx' configuration.
With that said, some other special surprises may be in store.