[HOWTO] Use a remote script via SSH as Data Input, no SNMP
Moderators: Developers, Moderators
-
- Cacti User
- Posts: 52
- Joined: Wed Apr 08, 2009 12:24 pm
Ah ha...........
I was putting a \n.
------------- SNIP ---------------------
my $callsAvailable = $maxCallsTotal-$callsInProgress;
print "callsAvailable:$callsAvailable callsInProgress:$callsInProgress source:$source \n";
-----------------------------------------
I am having other problems, I cant seem to create the RRD. I don't know if it is related to the newline char.
I noticed in mySQL poller output that there is no rrd_name associated with the poll but I see:
+---------------+----------+---------------------+---------------------------------------+
| local_data_id | rrd_name | time | output |
+---------------+----------+---------------------+---------------------------------------+
| 142 | | 2009-04-15 18:35:07 | callsAvailable:345 callsInProgress:39 |
+---------------+----------+---------------------+---------------------------------------+
I am going crazy trying to figure out why the RRD isnt being created. I guess I would of had poller problems too since I had a newline char.
Thanks guys.
------------- SNIP ---------------------
my $callsAvailable = $maxCallsTotal-$callsInProgress;
print "callsAvailable:$callsAvailable callsInProgress:$callsInProgress source:$source \n";
-----------------------------------------
I am having other problems, I cant seem to create the RRD. I don't know if it is related to the newline char.
I noticed in mySQL poller output that there is no rrd_name associated with the poll but I see:
+---------------+----------+---------------------+---------------------------------------+
| local_data_id | rrd_name | time | output |
+---------------+----------+---------------------+---------------------------------------+
| 142 | | 2009-04-15 18:35:07 | callsAvailable:345 callsInProgress:39 |
+---------------+----------+---------------------+---------------------------------------+
I am going crazy trying to figure out why the RRD isnt being created. I guess I would of had poller problems too since I had a newline char.
Thanks guys.
-
- Cacti User
- Posts: 52
- Joined: Wed Apr 08, 2009 12:24 pm
I read your post on the newline character
1) Do I use SCRIPT/COMMAND Or choose other type for the data template
2) Do I create the output name EXACTLY the same as the return list?
For example if the return set is:
callsInProgress:15 callsTotal:400 source:level3
can the output variables be
calls_in_progress
call_total
source
I have different names in the data template.
2) Do I create the output name EXACTLY the same as the return list?
For example if the return set is:
callsInProgress:15 callsTotal:400 source:level3
can the output variables be
calls_in_progress
call_total
source
I have different names in the data template.
-
- Cacti User
- Posts: 52
- Joined: Wed Apr 08, 2009 12:24 pm
I got it
Yes...... the "Output Fields" in the Data Input Methods DO NEED TO BE THE SAME NAME. I took out the \n and that may of helped.
I was getting confused on whether or not I was doing a Script Command or a Script Query. I don't see a lot of documentation on the various data acquisition types. But SCRIPT/COMMAND worked. I looked at the example "Unix - Get Load Average" and that helped to see multiple return values.
I figure myself to be fairly intelligent, but it seems like learning cacti has been an endeavor. I would mainly say the terminology is a tad confusing, but once I got to moving around now things are making more sense.
Thanks WHITE-JEREON
I was getting confused on whether or not I was doing a Script Command or a Script Query. I don't see a lot of documentation on the various data acquisition types. But SCRIPT/COMMAND worked. I looked at the example "Unix - Get Load Average" and that helped to see multiple return values.
I figure myself to be fairly intelligent, but it seems like learning cacti has been an endeavor. I would mainly say the terminology is a tad confusing, but once I got to moving around now things are making more sense.
Thanks WHITE-JEREON
- white-jeroen
- Posts: 25
- Joined: Sat Mar 22, 2008 10:35 am
Yes Michael, learning to make custom scripts to feed Cacti with data is kind of a steep learning curve. But it is worth it! Is is beautiful to see a graph growing using the data your own script provided.
This is the main reasons why I've written some HOWTO's when I finally found out how to do things.
I've been working at a big Dutch hosting provider, and I used MRTG to draw graphs for quite a few servers. We had an enormous config file, and when we had some new servers we needed to copy lots of config lines to create all the graphs. Especially making custom graphs was complicated.
When I moved to my current job, at that time the company was buying its first servers. I didn't want the MRTG mysery again, so I looked for an alternative. Cacti is perfect for the job! With templates you can add a server in one minute!
This is the main reasons why I've written some HOWTO's when I finally found out how to do things.
I've been working at a big Dutch hosting provider, and I used MRTG to draw graphs for quite a few servers. We had an enormous config file, and when we had some new servers we needed to copy lots of config lines to create all the graphs. Especially making custom graphs was complicated.
When I moved to my current job, at that time the company was buying its first servers. I didn't want the MRTG mysery again, so I looked for an alternative. Cacti is perfect for the job! With templates you can add a server in one minute!
Jeroen Vermeulen BVBA - freelance PHP, Perl & Magento expert - http://www.jeroenvermeulen.eu/
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
You are aware of http://docs.cacti.net/manual:087 ?white-jeroen wrote:Yes Michael, learning to make custom scripts to feed Cacti with data is kind of a steep learning curve. But it is worth it! Is is beautiful to see a graph growing using the data your own script provided.
Reinhard
- white-jeroen
- Posts: 25
- Joined: Sat Mar 22, 2008 10:35 am
Yes... if all else fails...
Jeroen Vermeulen BVBA - freelance PHP, Perl & Magento expert - http://www.jeroenvermeulen.eu/
-
- Cacti User
- Posts: 52
- Joined: Wed Apr 08, 2009 12:24 pm
Yes, Gandalf.............
Im giggling. I printed it, carried it around for a couple of days, and read thru it.
Im giggling because I see you always tell'n people to read it. One thing I noticed, being new to Cacti, is that I couldn't tell if something is working or not. The timing was totally new to me. Like for example, Im 2 hours into using Cacti, and I am getting an error say "No rrd", it took some time, but now I realize, that is queued in the poller.
The documentation is wonderful, you did a great job, and I just wanted to say thanks bro!
Im giggling because I see you always tell'n people to read it. One thing I noticed, being new to Cacti, is that I couldn't tell if something is working or not. The timing was totally new to me. Like for example, Im 2 hours into using Cacti, and I am getting an error say "No rrd", it took some time, but now I realize, that is queued in the poller.
The documentation is wonderful, you did a great job, and I just wanted to say thanks bro!
- white-jeroen
- Posts: 25
- Joined: Sat Mar 22, 2008 10:35 am
When things are not working I go check:
System Utilities -> View Cacti Log File
To see if there are any yellow or red lines, the Host and DataSource numbers are clickable.
System Utilities -> View Poller Cache
To see the commandlines of the scripts executed, so I can do it in Shell, being the user that runs cacti.
It the commandline seems to be outdated I click:
System Utilities -> Rebuild Poller Cache
System Utilities -> View Cacti Log File
To see if there are any yellow or red lines, the Host and DataSource numbers are clickable.
System Utilities -> View Poller Cache
To see the commandlines of the scripts executed, so I can do it in Shell, being the user that runs cacti.
It the commandline seems to be outdated I click:
System Utilities -> Rebuild Poller Cache
Jeroen Vermeulen BVBA - freelance PHP, Perl & Magento expert - http://www.jeroenvermeulen.eu/
-
- Cacti User
- Posts: 52
- Joined: Wed Apr 08, 2009 12:24 pm
Thanks White Jeroen.......
For some reason I didn't pick that up in reading the docs. That was very useful when I picked it up.
Part of my biggest problem was figuring out why a RRD was not being generated. Being totally new, I thought because I created a graph it should show, but thats not true. The RRD is created on the next poll.
Hrm......... I wonder if the RRD statement shows in the poller cache.
But thanks, your tid-bits on debugging help me understand what to look for.
Best Regards!
Part of my biggest problem was figuring out why a RRD was not being generated. Being totally new, I thought because I created a graph it should show, but thats not true. The RRD is created on the next poll.
Hrm......... I wonder if the RRD statement shows in the poller cache.
But thanks, your tid-bits on debugging help me understand what to look for.
Best Regards!
- white-jeroen
- Posts: 25
- Joined: Sat Mar 22, 2008 10:35 am
You can see the RRD command in Graph debug mode:
To test the command yourself:
- Click "Graph Management" from the left bar
Click the graph you want to know the RRD command from
On the right top of the screen click "Turn On Graph Debug Mode", you might need to scroll left to see it
You will see the RRD command in the bottom right of your screen
To test the command yourself:
- Log into shell being the user that runs cacti
Past the command you copied from the debug mode
Type behind it (without quotes): " > /tmp/test.png "
Execute the cmmand
Move the /tmp/test.png to a httpdocs dir of a website where you can view it
Jeroen Vermeulen BVBA - freelance PHP, Perl & Magento expert - http://www.jeroenvermeulen.eu/
-
- Cacti User
- Posts: 52
- Joined: Wed Apr 08, 2009 12:24 pm
Thanks!
It worked. I will remember that.
Re: [HOWTO] Use a remote script via SSH as Data Input, no SN
I'm tried to follow your how-to.
I need to graph a number of ppp conections of a mikrotik router.
I'm using the command:
In the shell, the command runs normally and returns the expected value.
I created the data template an the graph template, but the result is a graph empty.
The cacti log says ok, and the debug output is:
how should I proceed?
I need to graph a number of ppp conections of a mikrotik router.
I'm using the command:
Code: Select all
echo -n "usuarios:"$(ssh acesso@<hostname> -p 2223 pp act p c)
I created the data template an the graph template, but the result is a graph empty.
The cacti log says ok, and the debug output is:
Code: Select all
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='Usurios Conectados' \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/rb1000_pppactive_95.rrd":pppactive:AVERAGE \
AREA:a#35962BFF:""
- white-jeroen
- Posts: 25
- Joined: Sat Mar 22, 2008 10:35 am
Re: ppp conections of a mikrotik router
Hi Ilunne,
If you can do it, Cacti should be able to do it too.
A few things that might help you:
Kind regards, Jeroen Vermeulen
If you can do it, Cacti should be able to do it too.
A few things that might help you:
- Did you test the command being the same user that Cacti's cron job is executed under?
- The "Graph Debug" does not provide any help about if the RRD (Data Source) receives data or not
- What does provide help:
- Go to: Console > Settings > General and switch the Poller Logging Level to HIGH
- Wait 10 minutes so the cron did run a few times
- Go to: Console > System Utilities > View Cacti Log File
- Search for your command and check the output
Kind regards, Jeroen Vermeulen
Jeroen Vermeulen BVBA - freelance PHP, Perl & Magento expert - http://www.jeroenvermeulen.eu/
Re: [HOWTO] Use a remote script via SSH as Data Input, no SN
Thank you for this great tutorial! It's just what I was looking for
This might sound like a very amateur question, but how can I determine what user Cacti uses on the Cacti host to run the Cron job? In the tutorial you assume it's the user "cacti", but I have no such user.
Thanks!
This might sound like a very amateur question, but how can I determine what user Cacti uses on the Cacti host to run the Cron job? In the tutorial you assume it's the user "cacti", but I have no such user.
Thanks!
- white-jeroen
- Posts: 25
- Joined: Sat Mar 22, 2008 10:35 am
Re: [HOWTO] Use a remote script via SSH as Data Input, no SN
You can try the following command to find the cron job (as root):how can I determine what user Cacti uses on the Cacti host to run the Cron job?
Code: Select all
grep -ir 'cacti' /var/spool/cron/crontabs
For example: /var/spool/cron/crontabs/[USER]: */5....
If you didn't find it you can try (as root):
Code: Select all
grep -ir 'cacti' /etc/cron*
For example: * * * * [USER]
Jeroen Vermeulen BVBA - freelance PHP, Perl & Magento expert - http://www.jeroenvermeulen.eu/
Who is online
Users browsing this forum: No registered users and 0 guests