Ad Widget

Collapse

pulling zabbix info to external page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wpervaiz
    Member
    • May 2009
    • 30

    #1

    pulling zabbix info to external page

    i'm looking to pull out some info from zabbix (i.e. the "System status" screen from the dashboard page); and display it on an external php page that I keep on my company website. Is there a way I could let apache log in and pull that info from my zabbix server ?

    I know the zabbix firefox plugin does something similar so if theres an easy way to do this, it would be much appreciated!

    thanks!
  • pesadilla
    Member
    • Nov 2006
    • 69

    #2
    you need first login with your application

    then in your cookie you need get "sid" value doing:

    zbx_sessionid cookie value is 32characters
    yo need get 16 last
    example:
    zbx_sessionid = "edb8432bc7b09992bba82519ea14d666"
    sid is bba82519ea14d666

    and you can send post to dashboard.php
    example:

    post to

    with params like:
    favcnt 10
    favid hat_lastiss
    favobj set_rf_rate

    (use firebug and enable network to zabbix form see post params)

    Comment

    • Kai-Kai
      Senior Member
      • Apr 2009
      • 142

      #3
      What about taking the informations directly in the database with a query ?
      Won't it be easier ?

      You just execute one or more query to collect what you want to display, then you display it the way you want using php code, on your website. I think it's more simple no ?

      Comment

      • wpervaiz
        Member
        • May 2009
        • 30

        #4
        thanks a lot !!!

        For anyone looking to do this, here is what i did:

        Code:
        	//authenticating first
                xmlHttp0.open("GET", "index.php?form=1&form_refresh=1&name=USER_NAME_HERE&password=ENTER_PASSWORD_HERE&enter=Enter", true);
        
        
        	xmlHttp0.onreadystatechange = function()
        	{
        		if (xmlHttp0.readyState == 4 && xmlHttp0.status == 200)
        		{ 
        			var cookieStart=document.cookie.indexOf("zbx_sessionid=")+30;
        			zabbix_sid = document.cookie.substring(cookieStart,cookieStart+16);
        
        			xmlHttp.open("GET", "dashboard.php?output=html&favid=hat_syssum&favobj=refresh&sid="+zabbix_sid, true);
        			xmlHttp.send(false);
        		}
        
        	}
        
        	xmlHttp0.send(false);
        
        
        	
        	xmlHttp.onreadystatechange = function()
        	{
        		if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
        		{ 
        			document.getElementById("status").innerHTML = "<html:span>" + xmlHttp.responseText +"</html:span>";
        		} 
        	} 
        
        
        	xmlHttp.send(false);


        This gives me the system over view without having a user log in manually each time.... my next goal is to parse this information and generate an image that can be sent out automatically via email x times a day.

        thanks again !

        Comment

        Working...