initial commit of file from CVS for smeserver-cacti on Sat Sep 7 20:12:27 AEST 2024
This commit is contained in:
16
root/etc/e-smith/events/actions/cacti-conf
Normal file
16
root/etc/e-smith/events/actions/cacti-conf
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
#easy configuration of what is needed for cacti to work correctly
|
||||
something=0;
|
||||
psomething=0;
|
||||
#check if something already set, if not let's do it
|
||||
|
||||
/sbin/e-smith/config getprop mariadb TmpTableSize 1>/dev/null || ( config setprop mariadb TmpTableSize 32M ; echo "setting mariadb TmpTableSize 32M" ; something=1)
|
||||
/sbin/e-smith/config getprop mariadb MaxHeapTableSize 1>/dev/null || ( config setprop mariadb MaxHeapTableSize 32M ; echo "setting mariadb MaxHeapTableSize 32M" ; something=1)
|
||||
/sbin/e-smith/config getprop mariadb JoinBufferSize 1>/dev/null || ( config setprop mariadb JoinBufferSize 62M ; echo "setting mariadb JoinBufferSize 62M" ; something=1)
|
||||
|
||||
#/sbin/e-smith/config getprop php74 MemoryLimit 1>/dev/null || ( config setprop php74 MemoryLimit 800M ; echo "setting php74 memory_limit 800M" ; psomething=1)
|
||||
# install detect cli for php not php74 even if $php_path is set
|
||||
|
||||
#[ $something == 1 ] && /sbin/e-smith/expand-template /etc/my.cnf
|
||||
#[ $psomething == 1 ] && /usr/sbin/e-smith/expand-template /etc/opt/remi/php74/php.ini && /usr/bin/systemctl restart php74-php-fpm.service
|
53
root/etc/e-smith/events/actions/cacti-install
Normal file
53
root/etc/e-smith/events/actions/cacti-install
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# move to cli dir
|
||||
cd /usr/share/cacti/cli
|
||||
|
||||
#install, we put away, it fails in the temp event in yum at first, so here is a dirty hack
|
||||
/usr/bin/php install_cacti.php &
|
||||
pids=$!; sleep 3; kill -9 $pids;
|
||||
/usr/bin/php install_cacti.php --accept-eula --install || exit 0
|
||||
|
||||
#TODO:
|
||||
#--automationmode
|
||||
#--automationrange with LAN if server-gateway; or only interface if server only
|
||||
#--lang (using an array between cacti option and system language)
|
||||
# using this to set ldap ? --ldap:dn:...
|
||||
# do we need a --mode=upgrade and a --mode=install
|
||||
|
||||
db=$(config getprop cacti DbDatabase || echo 'cacti_sme');
|
||||
user=$(config getprop cacti DbUser || echo 'cacti');
|
||||
pass=$(config getprop cacti DbPassword || echo 'changeme');
|
||||
adminpass=$(config getprop cacti AdminPassword || echo 'changeme');
|
||||
domain=$(config get DomainName)
|
||||
DN=$(perl -Mesmith::util -e "print esmith::util::ldapBase(\"$domain\");")
|
||||
|
||||
# set ldap auth with optional group
|
||||
# ldap_group_require 'on' or '': user will enable if needed.
|
||||
# then set our admin password
|
||||
/usr/bin/mysql <<EOF
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_group_attrib','memberUid') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_group_dn','uid=cactigroup,ou=Groups,$DN') ;
|
||||
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_tls_certificate','0') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_version','3') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_server','localhost') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_search_filter','objectClass=inetOrgPerson') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_search_base','ou=Users,$DN') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_referrals','0') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_port_ssl','636') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_port','389') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_mode','0') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_encryption','0') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('ldap_dn','uid=<username>,ou=Users,$DN') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('auth_method','3') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('cn_full_name','cn') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('cn_email','mail') ;
|
||||
REPLACE INTO ${db}.settings VALUES ('path_php_binary','/usr/bin/php74') ;
|
||||
|
||||
REPLACE INTO ${db}.settings VALUES ('user_template','3');
|
||||
|
||||
# set password of admin
|
||||
UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1';
|
||||
EOF
|
||||
|
Reference in New Issue
Block a user