using scripts with cacti

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
trfunite
Posts: 7
Joined: Sun Apr 01, 2007 9:40 pm

using scripts with cacti

Post by trfunite »

Hi,
Currently the system engineer in my company is using scripts to pull data for cpu, hard disk, memory NIC usage etc. Is there a way for cacti to use the same scripts to do the pulling of data rather then using snmp? Cause i'm having problem using snmp to pull data for AIX and solaris. Could someone please advice me how can i do it or where can i find the guide for me to do it? Please advice. thanks a lot.

Regards
Malcum
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Cacti 0.8.6 HowTo » Advanced Magic : http://docs.cacti.net/node/224
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
trfunite
Posts: 7
Joined: Sun Apr 01, 2007 9:40 pm

Post by trfunite »

I've got some scripts from my system admin. but i was told that cacti must be able to establish some sort of connection to the server to run the scripts. but i'm i cant seems to find any instructions on how to telnet or ssh to the system to run the scripts. Could someone please advice me on this part? Thanks a lot.
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

The script will need to reside on the box that Cacti runs on. Put the script in the script folder. You then create your data input method as outlined in http://docs.cacti.net/node/296 and then create your data source and get the data source to call the data input method you created.

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please see http://forums.cacti.net/viewtopic.php?t=24960 for some hints
Reinhard
trfunite
Posts: 7
Joined: Sun Apr 01, 2007 9:40 pm

Post by trfunite »

sorry but there is still one part i dont understand. as mention by jay just that the script needs to reside on cacti server under the scripts folder. but what i'm confuse is that how does cacti actually pull data from the server using the scripts? I've been question on this part by the system admin and i'm unable to answer them. i showed them how i add the host and the template but still we dont understand how the whole polling of data using scripts work. Could someone please advice me on this part? Thanks a lot in advance.
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Hi

Take a look at the following

Data input methond and scripts documentation
http://docs.cacti.net/node/25
http://docs.cacti.net/node/26

Php script server documentation
http://docs.cacti.net/node/38

user submitted document on how to use scripts to log data
http://docs.cacti.net/node/521

If none of these help you then someone else will have to answer your question.

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
bbice
Cacti User
Posts: 71
Joined: Mon May 13, 2002 6:53 pm

Post by bbice »

trfunite wrote:sorry but there is still one part i dont understand. as mention by jay just that the script needs to reside on cacti server under the scripts folder. but what i'm confuse is that how does cacti actually pull data from the server using the scripts?
Be sure to skim the links the others posted as there's a ton of info on various ways to do this. Basically, you can have a script on the cacti server that connects to some service port on the remote machine to get the data. For instance, you might have inetd configured to listen on a specific port and just run a non-interactive script that dumps the results, then a perl script on the cacti server can connect to that port on the remote machine, gather the result and parse the output. Not terribly secure and not the way I'd do it, but it'd work.

You could have ssh configured so the cacti user had an ssh key and was allowed to remotely run the script via ssh (with no password to log in -- using the ssh certificate to authenticate) and thus you could make a script which resides on the cacti server that uses ssh to run some other script on the remote server and parse the output into a form cacti likes. Again, not the way i'd probably do it, but...

You could have net-snmp running on the remote machine and glue in the script that gets the data you want into net-snmp using the exec or pass commands in the snmpd.conf file. For instance, to gather postfix stats, I have a few scripts that run on the postfix server. net-snmp on the postfix relays is configured with these lines:
pass .1.3.6.1.4.1.2021.254 /usr/local/bin/countqueue.pl .1.3.6.1.4.1.2021.254
pass .1.3.6.1.4.1.2021.253 /usr/local/bin/queueage.pl .1.3.6.1.4.1.2021.253

So now cacti can send a variety of queries to 1.3.6.4.1.2021.254.something and net-snmp will pass these queries to the right perl script. These scripts look at the remainder of the OID being queried (the part beyond the .253 or .254) to figure out what I'm querying (ie, countqueue.pl gives the number of messages in a queue and the extra number in the OID determines which queue is being queried for). Then I just need to make cacti templates (using a normal snmp query and the appropriate OID) to gather all the ddifferent sorts of data and graph 'em. Tidy. This is how I usually glue odd stuff into cacti.

But like I said, go skim those other URLs too. There's loads of examples of different ways to hook interesting things into cacti.
trfunite
Posts: 7
Joined: Sun Apr 01, 2007 9:40 pm

Post by trfunite »

thanks a lot for the help guys. i'm looking into it.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests