Nagios status report in Ion3 statusbar
Here is a little script that permits to report one or more nagios servers status in the ion3 status bar:
statusd_nginfo.lua (Download)
-- -- statusd_nginfo.lua -- -- Made by Raffaello Pelagalli -- -- Started on Sun Mar 9 00:22:31 2008 Raffaello Pelagalli -- Last update Thu May 8 23:29:32 2008 Raffaello Pelagalli -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this library; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA -- -- Nagios checking script -- Reports nagios status in ion status bar -- Sample configuration: -- mod_statusbar.launch_statusd{ -- ... -- nginfo = { -- urls = { -- "http://user1:password1@server1.domain1.tld/cgi-bin/nagios2/nginfo.pl", -- "http://user2:password2@server2.domain2.tld/nagios/cgi-bin/nginfo.pl", -- }, -- } -- ... -- } -- -- Need to be used with nginfo.pl script from -- http://redstack.net/blog/index.php/2008/05/08/nagios-status-report-in-ion3-statusbar.html require "lxp" local ng_timer local error = false local status = {0, 0, 0, 0} local defaults = { update_interval=30*1000, urls = { }, } local settings = table.join(statusd.get_config("nginfo"), defaults) nginfo_callbacks = { StartElement = function (parser, name) if (name == "current_state") then nginfo_callbacks.CharacterData = function (parser, val) status[tonumber(val) + 1] = status[tonumber(val) + 1] + 1 end end end, EndElement = function (parser, name) if (name == "current_state") then nginfo_callbacks.CharacterData = false end end, CharacterData = false, } function parse (data) p = lxp.new(nginfo_callbacks) p:parse(b) p:close() end function get_nginfo () status = {0, 0, 0, 0} error = false local http = require("socket.http") socket.http.TIMEOUT=10 local errstr = " ERROR while reading data" for n, url in pairs(settings.urls) do b, c, h = http.request(url) if not (c == 200) then error = true errstr = errstr .. " (NET " .. tostring(c) .. ")" else local st, err = pcall(parse, b) if not st then error = true errstr = errstr .. " (XML" .. err .. ")" end end end if not error then errstr = "" end return "OK: " .. tostring(status[1]) .. ", WARN: " .. tostring(status[2]) .. ", ERROR: " .. tostring(status[3]) .. ", UNKN: " .. tostring(status[4]) .. errstr end local function update_nginfo() statusd.inform("nginfo", get_nginfo()) if (status[3] > 0 or status[4] > 0) then statusd.inform("nginfo_hint", "critical") elseif (status[2] > 0) then statusd.inform("nginfo_hint", "important") else statusd.inform("nginfo_hint", "normal") end ng_timer:set(settings.update_interval, update_nginfo) end -- Init ng_timer=statusd.create_timer() update_nginfo()
This nginfo.pl script needs to be installed on nagios servers :
nginfo.pl (Download)
#!/usr/bin/perl use Nagios::StatusLog; my $log = Nagios::StatusLog->new( Filename => "/var/cache/nagios2/status.dat", Version => 2.0 ); print("Content-type: text/xml\n\n"); print("<?xml version='1.0'?>"); print("<status>\n"); foreach my $host ($log->list_hosts()) { print("<host>\n<name>$host</name>\n<services>"); foreach my $serv ($log->list_services_on_host($host)) { print ("<service>\n"); print (ref $serv); my $st = $log->service($host, $serv); foreach $tag ($st->list_tags()) { print("<$tag>$$st{$tag}</$tag>\n"); } print ("</service>\n"); } print("</services>\n</host>\n") } print("</status>");
Information on installing lua scipts for ion3 can be found here
November 27th, 2011 at 02:14
buy propecia online Colorado Nebraska buy propecia online http://buy-propeciaonline.webnode.com buy propecia online buy propecia online india buy propecia online Michigan
January 13th, 2012 at 12:26
varcevalni racun investicija
January 23rd, 2012 at 02:33
efbdysfetubdl, bbxvtrcakv
January 24th, 2012 at 02:58
lxcuisfetubdl, Clonazepam, IfiBryk.
January 24th, 2012 at 06:54
ocudgsfetubdl, Tadalafil 2.5mg, jbewNGv.
January 24th, 2012 at 11:00
swvlwsfetubdl, Purchase xanax overnight, MolPREM.
January 24th, 2012 at 14:16
amfttsfetubdl, Adderall alternative, AlbjgSj.
January 25th, 2012 at 22:15
vznussfetubdl, Meridia, Jueoryt.
January 26th, 2012 at 06:30
kbcspsfetubdl, sniper spy, OzbfZUQ.
January 26th, 2012 at 06:36
xzrcbsfetubdl, Better for infant teething pain tylenol or motrin, FlHCjgH.
January 26th, 2012 at 06:37
pvcpksfetubdl, Travel tracker create maps, IpRNZOw.
January 26th, 2012 at 09:58
bbbhjsfetubdl, Kegunaan obat lyrica sildenafil rx drugstore online, RoCSflz.
January 27th, 2012 at 12:31
dsbwpsfetubdl, Dr oz and hcg diet, kSMBbCw.
January 27th, 2012 at 19:32
vuattsfetubdl, Xanax, cWbCIws.
January 28th, 2012 at 00:13
vchvcsfetubdl, Max burn, UOefLVN.
January 28th, 2012 at 04:37
aygiusfetubdl, Trend trade forex chaos timeframe, HzfbGpl.
January 28th, 2012 at 20:47
tqtxcsfetubdl, Speed up your computer the need for speed how to speed up, JRuDChN.
January 29th, 2012 at 06:47
kxkdmsfetubdl, Camaraderie kamagra gastenboek bericht naam e-mail, mkgsLgF.
January 29th, 2012 at 08:08
zmjdcsfetubdl, How to get abs filipino girl, NSNYcBT.
January 29th, 2012 at 10:28
hlbxwsfetubdl, Lorazepam ativan, llyQfZT.
January 29th, 2012 at 13:19
nebtesfetubdl, Bph and taking levitra, xBlneqF.
January 30th, 2012 at 09:30
selltsfetubdl, Lunesta for sale, PoDNWQt.
January 30th, 2012 at 13:47
zgsxisfetubdl, Klonopin vs valium, JGfuJiW.
January 30th, 2012 at 21:18
rsipdsfetubdl, Is valium a depressant, rxNrcEU.
January 30th, 2012 at 21:24
dlerssfetubdl, Buy .5 mg klonopin, XZYzUNZ.
January 30th, 2012 at 23:54
jvrqesfetubdl, Valium over the counter, AxEjheT.
January 31st, 2012 at 04:51
dxzefsfetubdl, Purchase xanax overnight, bofhoWf.
February 1st, 2012 at 11:22
kojiwsfetubdl, Lunesta, pfldAgo.
February 1st, 2012 at 14:55
anywosfetubdl, floheehqhi
February 2nd, 2012 at 01:01
wppdwsfetubdl, Cialis, dhWcwcY.
February 2nd, 2012 at 11:43
wdsynsfetubdl, Effects of klonopin, VJCYKhf.
February 2nd, 2012 at 11:56
lyayhsfetubdl, 50 picture alprazolam, NryHcso.
February 2nd, 2012 at 13:37
otoiosfetubdl, Diazepam dosages, uTtZqxA.
February 2nd, 2012 at 14:10
jippesfetubdl, Alprazolam, XoHdacA.
February 2nd, 2012 at 14:56
nfunnsfetubdl, Diazepam apaurin by krka, aYmrSjn.
February 2nd, 2012 at 15:43
iqtinsfetubdl, Cheap clonazepam online, frVaevF.
February 2nd, 2012 at 21:06
yqqrysfetubdl, Taper from ambien with sublingual melatonin, xtpAJJq.
February 3rd, 2012 at 07:03
jippesfetubdl, Ultram, oHdacAp.
February 3rd, 2012 at 08:32
mpldysfetubdl, Miracet, udqybEE.
February 3rd, 2012 at 09:14
ucwvvsfetubdl, Caralluma Burn, XbssMac.
February 3rd, 2012 at 10:22
aexsdsfetubdl, Melatrol, MZHrvwR.
February 3rd, 2012 at 11:15
vrqsysfetubdl, Yeastrol, oaFskVO.
February 3rd, 2012 at 15:58
sretvsfetubdl, Hoodia Chaser, yyuvnoj.
February 3rd, 2012 at 18:52
jgqjcsfetubdl, Prostacet, UUczpkh.
February 3rd, 2012 at 20:09
lslwysfetubdl, Natural na pampalaki ng burat velvet deer antler plus, JHseHXL.
February 3rd, 2012 at 23:27
zzftksfetubdl, Lemonade Diet, GCjxDmZ.
February 4th, 2012 at 02:09
iarzasfetubdl, Has anyone tried the dual action cleanse, NparjmG.
February 4th, 2012 at 17:47
kxeuxsfetubdl, Where can i buy electronic cigarettes, DOsxBlX.
February 4th, 2012 at 19:43
ovkqvsfetubdl, Binary options pdf, PnLgSsT.
February 4th, 2012 at 23:25
kgwsasfetubdl, Day trading online binary options, ymagPdB.