Quick and dirty script to add devices to cacti

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

Moderators: Developers, Moderators

Post Reply
bonibr
Posts: 1
Joined: Tue Jan 15, 2013 9:20 am

Re: Quick and dirty script to add devices to cacti

Post by bonibr »

Hello,

I have problems with my old server, more specifically in the mysql database and had to redo the server.

In create a new server, I'm having trouble inserting devices with host-script add-script.php on Cacti version 0.8.8a.

Besides the problem of variable "mb_strtolower" which converted to" strtolower" he presents data errors and the API api_device.php that contains one more item, the variable "device_threads"

Can anyone help me?

Old server: Debian
New server: CentOS

php hosts-add-script.php --cacti=/var/www/cacti --separator=';' --f=hosts-files-to-add.txt
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 165
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 165
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 166
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 166
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 167
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 167
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 168
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 168
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 169
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 169
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 170
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 170
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 171
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_constants.php on line 171
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 670
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 670
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 671
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 671
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 672
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 672
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 673
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 673
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 674
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 674
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 675
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 675
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 676
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRST/-2.0/DST' instead in /var/www/cacti/include/global_arrays.php on line 676
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Quick and dirty script to add devices to cacti

Post by gandalf »

You should do what the error messages tells you to do. This was introduced by newer versions of PHP: it REQUIRES the timezone to be set
R.
Dan5ielle
Posts: 8
Joined: Sat Jan 19, 2013 2:22 am

Re: Quick and dirty script to add devices to cacti

Post by Dan5ielle »

this is a very important addon. perhapse you can post the script so we can test.
Image
Image
Image
Image
Image
kaktusbits
Posts: 1
Joined: Thu Jun 13, 2013 2:03 pm

Re: Quick and dirty script to add devices to cacti

Post by kaktusbits »

Hello cacti Guru's,

I want to add 200+ IP addresses as including name of the host. Such as;

Description: xyz Server
Hostname: 192.168.1.1
Host Template: Cisco
Thold Up/Down Email Notification: Global List
Downed Device Detection: Ping
Ping Method: ICMP Ping

adding manually like this takes to much time. Give advise how to handle this issue with script, please !

P.s: my cacti "version 0.8.8a"

http://www.cacti.net/downloads/docs/htm ... evice.html

I want to add "description" and "hostname" from csv file !
tongus
Posts: 1
Joined: Thu Feb 06, 2014 7:39 am

Re: Quick and dirty script to add devices to cacti

Post by tongus »

hi, newbie,
i'd like to know how to use the script above with csv file where i'll put the information of all device i want to discover and graph
thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests