CACTI VIA PROXY

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

CACTI VIA PROXY

Post by Maher457 »

hello is there any way to supervise internet from cacti via proxy?because now i supervise it directly via a firewall and directly to the internet.
Thanks
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Attach a picture,
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

In my society from our post we have an account that will redirect us to proxy and we pass to internet via proxy
with my cacti on my post i measure the HTTP response time of a website.
But cacti don't pass by a proxy it pass directly to internet.So it's complicated to give cacti an account and tell it to pass via a proxy i don't how to do.
Do you know what should i do?
or do u have another solution that cacti that measure the time of HTTP response and graph it from my post
Thank you
Attachments
cacti.JPG
cacti.JPG (638.12 KiB) Viewed 19518 times
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Well your first problem is that you will get false positives if you are going through a proxy. So, you might have to go to a push type method. However, I imagine that you will have even more issues related to getting data 'in' from the internet.

If the proxy is automatic and requires no authentication, you will have to setup a port that does not cache responses on the proxy and use that for your response time request. Then it becomes no different than a firewall.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

I guess if you are able to control the content of the webpage ( e.g. adding meta headers to tell the proxy not to cache it, always provide some dynamic content etc.) caching shouldn't be too much of a concern ?

For the auth, you could use a script which goes and fetches the webpage and returns a number you can use to put into cacti ( Data inpuit methods ...)

The following perl code works for NTLM based proxies, too ...

Code: Select all

#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common;
use Time::HiRes qw { time };

# Get the arguments from command line, or set them static here.
$proxyServer = $ARGV[0];
$proxyPort = $ARGV[1];
$url = $ARGV[2];

# Username/Password, for NTLM Auth use the following format
$proxyUsername="DOMAIN\\Username";
$proxyPassword="password";


# Set up the ntlm client
# and then the base64 encoded ntlm handshake message
$ua = new LWP::UserAgent(keep_alive=>1);
$ua->proxy(http  => 'http://'.$proxyServer.':'.$proxyPort);

# Set the proxy and credentials to use for that proxy.
$netloc = "$proxyServer:$proxyPort";
$ua->credentials($netloc, '', $proxyUsername, $proxyPassword);

my $startTime = time();

# Start the URL retrieval
$request = GET $url;
$response = $ua->request($request);
# End of URL retrieval

$totaltime = time() - $startTime;
if ($response->is_success) {
    print $totaltime;
}
else {
    print "U";
}
Last edited by phalek on Thu Sep 16, 2010 3:16 am, edited 1 time in total.
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
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Almost indistinguishable from PHP these days ;)

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

Yeah ;)
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
Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

Thank you for your script that's exactly what i need but i didn't understand where to put ur script.
I'm doing a measure of HTTP response time that i found in the forum.
here's the code it's called http_nrpe.pl and it uses a file check_http
i have attached this script.
should i put ur script in the http_nrpe.pl down the already existing code?or where?
please help
thank you
Attachments
nrpe_http.pl
(272 Bytes) Downloaded 3439 times
cacti.JPG
cacti.JPG (2.25 MiB) Viewed 19283 times
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

I would change the input string to:

Code: Select all

perl <path_cacti>/scripts/proxiedHttpCheck.pl 10.0.10.1 8080 <ip>
where "proxiedHttpCheck.pl" is the script posted by me,
"10.0.10.1" needs to be your proxy server
"8080" is the port of your proxy.

that should do it.
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
Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

so i have to put the script code before or after the code aldready exsisting nrpe_http.pl?
i didnt understand what i should change in ur code can u give the full code please?
thank you
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

The code is complete so far.
You only need to change the following lines:

Code: Select all

# Username/Password, for NTLM Auth use the following format
$proxyUsername="DOMAIN\\Username";
$proxyPassword="password"; 
And you do not need to exectue/call the check_http file or the nrpe_http.pl file.
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
Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

i undertand ur point but i want to have one graph of http response time without proxy and another one via proxy.
What should i do to keep the two.
it's complicated what should i place as a XML file to have the date source and the data template
please help
Attachments
cacti_graph_template_http_response_time_nrpe_165.xml
(10.07 KiB) Downloaded 3034 times
Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

u see below the xml file what should i do now to create a nez graph template and associate the scripts to it
please give me a procedure to create it
tahnk you very much
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

hoestly, I would just go through the documentation and create another data input mehtod, data template and graph template:

http://docs.cacti.net/manual:087:3a_adv ... put_method
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
Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

thanks for ur instructions i followed them and put ur script in the script directory and modify the user and pass for the proxy
but i have no graph
in cacti log i have this error:

SPINE: Poller[0] Host[248] ERROR: Empty result [website ip adress]: 'perl /var/www/html/scripts/proxiedHttpCheck.pl [proxy IP] 8080 [website ip adress]'

when i run ur scipt in a console it didn-t recogniwe the "Use" syntax!!
please i need ur help
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests