script output loop

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
cheinzle
Posts: 15
Joined: Mon Nov 28, 2016 11:02 am

script output loop

Post by cheinzle »

From the Cacti docs:

"Note: Spine requires, that multiple parameters are spit out by a single “print” statement. Do not print them in a loop! "

Wondering if someone can enlighten me as to why loops don't work?
User avatar
camerabob
Cacti User
Posts: 386
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: script output loop

Post by camerabob »

Not sure, but you could loop an append to a variable instead and just print that variable once all the looping has completed. Simple work around.
Prod: Cacti 1.2.15 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Temp: Cacti 1.2.3 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Router Configs @ 1.3.4
Syslog Monitoring @ 2.1
Thold @ 1.2.4
cheinzle
Posts: 15
Joined: Mon Nov 28, 2016 11:02 am

Re: script output loop

Post by cheinzle »

I suppose. And for my script that wasn't working (Cacti log indicated that spine was receiving a truncated list of variables) making a single print statement fixed it. My question was fishing for more of a technical reason why spine doesn't like loops.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: script output loop

Post by netniV »

The poller expects a single line of output with the value. If you have multiple values, you have to use field:value combinations but they must all be on the same line again.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest