display graph to asp.net application

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
techlearner
Posts: 4
Joined: Sun Apr 07, 2013 12:51 am

display graph to asp.net application

Post by techlearner »

hi,

i have read the Beginner's Guide of Cacti 0.8. i am new to such an application.
i want to display the graph, generated by cacti in my asp.net-built application. this can be a web service or REST service, etc by which i can pass the values and get the graph or i can view the previously generated graph.
please tell me, is there any service by which i can communicate with cacti?

thanks in advance.
techlearner
Posts: 4
Joined: Sun Apr 07, 2013 12:51 am

Re: display graph to asp.net application

Post by techlearner »

is there anyone who can give me some HINTS !!! ???
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: display graph to asp.net application

Post by phalek »

Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
techlearner
Posts: 4
Joined: Sun Apr 07, 2013 12:51 am

Re: display graph to asp.net application

Post by techlearner »

thank you phalek. this is indeed helpful though the doc is not rich in describing the features with examples...
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: display graph to asp.net application

Post by phalek »

yes, I was lazy ...

Just ask me and I can provide you with some examples on how to use it but bascially it's this:
(btw, CactiUserPwd can either be the Cacti Password, or the "Mobile Token", depending on what you've choosen for that particular user ).

Code: Select all

        private String WebServiceURL = "";
        private String WebServiceKey = "guest";
        private String CactiUserId = "";
        private String CactiUserPwd = "";

        var ws = new webserviceService();
        ws.Url = this.WebServiceURL;
        String CactiClientSessionKey = ws.authUser(this.WebServiceKey, this.CactiUserId, this.CactiUserPwd);

		int iWidth = 2* ( Convert.ToInt32(234 * (DPIData / 160)) );
		int iHeight = 2* (Convert.ToInt32(102 * (DPIData / 160)) );
		if (iWidth < 50) { iWidth = 568; }
		if (iHeight < 50) { iHeight = 204; }
		
		Bitmap cactiGraph = this.BitmapFromBase64(ws.getGraph(CactiClientSessionKey, GraphId, graphStartTime, graphEndTime, iHeight.ToString(), iWidth.ToString(), hideLegend)
You will also need this function

Code: Select all

        private Bitmap BitmapFromBase64(string base64)
        {
            try
            {
                MemoryStream memory = new MemoryStream(Convert.FromBase64String(base64));
                Bitmap bitmap = BitmapFactory.DecodeStream(memory);
                return bitmap;

            }
            catch
            {
                Bitmap bmp = Bitmap.CreateBitmap(1, 1, Bitmap.Config.Rgb565);
                return bmp;
            }
        }
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
techlearner
Posts: 4
Joined: Sun Apr 07, 2013 12:51 am

Re: display graph to asp.net application

Post by techlearner »

ohhh, this is really gr8 help, i think.
but cacti is set up by our another department and they r using it. so what i need to do r8 now is - install the windows version at my dev machine using WAMP within VM. then i will write short program to just display the graph as a test app. if i succeeded then i'll integrate this feature to their (other dpt.) portal.
now, i am sure that there is at least someone who can give me hints if i face any difficulty.

thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests