This commit is contained in:
2023-07-04 19:02:36 +02:00
parent 9e4376823e
commit e5078deb40
47 changed files with 4060 additions and 4 deletions

48
Centos7/Vagrantfile vendored Normal file
View File

@ -0,0 +1,48 @@
VAGRANTFILE_API_VERSION = "2"
nodes = [
{ hostname: 'LAB-CENTOS-01', box: 'generic/centos7', ip: '192.168.1.201' }
]
unless Vagrant.has_plugin?("vagrant-reload")
puts 'Installing vagrant-reload Plugin...'
system('vagrant plugin install vagrant-reload')
end
unless Vagrant.has_plugin?("vagrant-proxyconf")
puts 'Installing vagrant-proxyconf Plugin...'
system('vagrant plugin install vagrant-proxyconf')
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each do |node|
config.vm.define node[:hostname] do |node_config|
node_config.vm.hostname = node[:hostname]
node_config.vm.box = node[:box]
node_config.vm.network "public_network", ip: node[:ip]
#node_config.vm.network "private_network", type: "dhcp"
node_config.vm.synced_folder('files/', '/Vagrantfiles', type: 'rsync')
config.vm.provision "shell", path: "scripts/install.sh"
config.vm.provision :reload
config.vm.provision "shell", inline: "echo 'INSTALLER: Installation Terminee, Centos 7 pret a etre utilise !!!'"
end
end
config.vm.provider :vmware_esxi do |esxi|
esxi.esxi_hostname = '192.168.1.145'
esxi.esxi_username = 'root'
esxi.esxi_password = 'P@ssw0rd'
esxi.esxi_hostport = 22
esxi.esxi_virtual_network = 'VM Network'
esxi.esxi_disk_store = 'datastore1'
esxi.guest_guestos = 'centos7-64'
esxi.resource_pool = '/'
esxi.guest_memsize = '8192'
esxi.guest_numvcpus = '4'
esxi.guest_nic_type = 'VMXNET3'
esxi.guest_disk_type = 'thick'
esxi.guest_boot_disk_size = 150
esxi.guest_virtualhw_version = '14'
esxi.guest_custom_vmx_settings = [['vhv.enable','TRUE'], ['floppy0.present','FALSE']]
end
end

120
Centos7/files/agent.cfg Normal file
View File

@ -0,0 +1,120 @@
# fusioninventory agent configuration
# all defined values match default
# all commented values are examples
#
# Target definition options
#
# send tasks results to an OCS server
#server = http://server.domain.com/ocsinventory
# send tasks results to a FusionInventory for GLPI server
#server = http://server.domain.com/glpi/plugins/fusioninventory/
server = http://glpi.exemple.lan/plugins/fusioninventory/
# write tasks results in a directory
#local = /tmp
#
# Task definition options
#
# disable software deployment tasks
#no-task = deploy
#tasks = inventory,deploy,inventory
#
# Target scheduling options
#
# maximum delay before first target, in seconds
delaytime = 3600
# do not contact the target before next scheduled time
lazy = 0
#
# Inventory task specific options
#
# do not list local printers
# no-category = printer
# allow to scan user home directories
scan-homedirs = 0
# allow to scan user profiles
scan-profiles = 0
# save the inventory as HTML
html = 0
# timeout for inventory modules execution
backend-collect-timeout = 30
# always send data to server
force = 0
# additional inventory content file
additional-content =
#
# Package deployment task specific options
#
# do not use peer to peer to download files
no-p2p = 0
#
# Network options
#
# proxy address
proxy =
# user name for server authentication
user =
# password for server authentication
password =
# CA certificates directory
ca-cert-dir =
# CA certificates file
ca-cert-file =
# do not check server SSL certificate
no-ssl-check = 0
# connection timeout, in seconds
timeout = 180
#
# Web interface options
#
# disable embedded web server
no-httpd = 0
# network interface to listen to
httpd-ip =
# network port to listen to
httpd-port = 62354
# trust requests without authentication token
httpd-trust =
#
# Logging options
#
# Logger backend, either Stderr, File or Syslog (Stderr)
logger = stderr
# log file
#logfile = /var/log/fusioninventory.log
# maximum log file size, in MB
#logfile-maxsize = 0
# Syslog facility
logfacility = LOG_USER
# Use color in the console
color = 0
#
# Execution mode options
#
# add given tag to inventory results
tag =
# debug mode
debug = 0
# time to wait to reload config (0 means no reload, it's default value)
# conf-reload-interval = 0

View File

@ -0,0 +1,19 @@
################################################################################
# COMMAND DEFINITIONS
# Syntax:
# command[]=
#
command[users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[swap]=/usr/lib64/nagios/plugins/check_swap -w 20% -c 10%
command[root_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p / -m
command[usr_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /usr -m
command[var_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /var -m
command[zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[total_procs]=/usr/lib64/nagios/plugins/check_procs -w 190 -c 200
command[proc_named]=/usr/lib64/nagios/plugins/check_procs -w 1: -c 1:2 -C named
command[proc_crond]=/usr/lib64/nagios/plugins/check_procs -w 1: -c 1:5 -C crond
command[proc_syslogd]=/usr/lib64/nagios/plugins/check_procs -w 1: -c 1:2 -C syslog-ng
command[proc_rsyslogd]=/usr/lib64/nagios/plugins/check_procs -w 1: -c 1:2 -C rsyslogd
command[check_yum]=/usr/lib64/nagios/plugins/check_yum.py

41
Centos7/files/snmpd.conf Normal file
View File

@ -0,0 +1,41 @@
#com2sec paranoid default EXEMPLE-PUB
com2sec readonly default EXEMPLE-PRIV
#com2sec readwrite default EXEMPLE-PRIV
#group MyRWGroup usm readwrite
group ROGroup v1 readonly
informsink 192.168.1.71 EXEMPLE-PRIV
# incl/excl subtree mask
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
view system included .1.3.6.1.4.1.2021.11
view System included .1.3.6.1.2.1.1
view System included .1.3.6.1.2.1.25.1.1
####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:
# context sec.model sec.level match read write notif
access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
access ROGroup "" v1 noauth exact all none none
# -----------------------------------------------------------------------------
syslocation France (configure /etc/snmp/snmpd.local.conf)
syscontact Root <administrateur@tips-of-mine.fr> (configure /etc/snmp/snmpd.local.conf)
# Check the / partition and make sure it contains at least 10 megs.
disk / 10000
# MUCH more can be done with the snmpd.conf than is shown as an
# example here.
exec .1.3.6.1.4.1.2021.54 hdNum /usr/local/bin/snmpdiskio hdNum
exec .1.3.6.1.4.1.2021.55 hdIndex /usr/local/bin/snmpdiskio hdIndex
exec .1.3.6.1.4.1.2021.56 hdDescr /usr/local/bin/snmpdiskio hdDescr
exec .1.3.6.1.4.1.2021.57 hdInBlocks /usr/local/bin/snmpdiskio hdInBlocks
exec .1.3.6.1.4.1.2021.58 hdOutBlocks /usr/local/bin/snmpdiskio hdOutBlocks

185
Centos7/scripts/install.sh Normal file
View File

@ -0,0 +1,185 @@
#!/bin/bash
echo '.'
echo ' /$$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$$ /$$ /$$ /$$$$$$ /$$ /$$ /$$$$$$$$'
echo '|__ $$__/|_ $$_/| $$__ $$ /$$__ $$ /$$__ $$| $$_____/ | $$$ /$$$|_ $$_/| $$$ | $$| $$_____/'
echo ' | $$ | $$ | $$ \ $$| $$ \__/ | $$ \ $$| $$ | $$$$ /$$$$ | $$ | $$$$| $$| $$ '
echo ' | $$ | $$ | $$$$$$$/| $$$$$$ /$$$$$$| $$ | $$| $$$$$ /$$$$$$| $$ $$/$$ $$ | $$ | $$ $$ $$| $$$$$ '
echo ' | $$ | $$ | $$____/ \____ $$|______/| $$ | $$| $$__/|______/| $$ $$$| $$ | $$ | $$ $$$$| $$__/ '
echo ' | $$ | $$ | $$ /$$ \ $$ | $$ | $$| $$ | $$\ $ | $$ | $$ | $$\ $$$| $$ '
echo ' | $$ /$$$$$$| $$ | $$$$$$/ | $$$$$$/| $$ | $$ \/ | $$ /$$$$$$| $$ \ $$| $$$$$$$$'
echo ' |__/ |______/|__/ \______/ \______/ |__/ |__/ |__/|______/|__/ \__/|________/'
echo '.'
echo '.'
echo '**********************'
echo '* INSTALLATION: VM OK'
echo '**********************'
echo '.'
echo '.'
echo '**********************'
echo '* INSTALLATION: Debut MAJ'
echo '**********************'
echo '.'
yum install epel-release -y
yum upgrade -y
yum upgrade -y
echo '.'
echo '**********************'
echo '* INSTALLATION: Fin MAJ'
echo '**********************'
echo '.'
echo '.'
echo '**********************'
echo '* INSTALLATION: Debut ENV'
echo '**********************'
echo '.'
echo ' - Desactivation SELINUX'
setenforce 0
sed -i --follow-symlinks "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux
echo ' - Parametrage'
echo LANG=fr_FR.utf-8 >> /etc/environment
echo LC_ALL=fr_FR.utf-8 >> /etc/environment
echo ' - Timezone'
sudo timedatectl set-timezone Europe/Paris
echo '.'
echo '**********************'
echo '* INSTALLATION: Fin ENV'
echo '**********************'
echo '.'
echo '.'
echo '**********************'
echo '* INSTALLATION: Debut AdminTools'
echo '**********************'
echo '.'
echo ' - Installation composants'
yum install htop yum-utils nano mlocate -y
echo ' - Installation Supervision'
yum install python36-pip net-snmp yum-utils -y
yum install nrpe nagios-plugins-* --skip-broken -y
echo ' - Configuration Supervision'
echo ' -- Modification du fichier : nrpe.cfg'
sed -i --follow-symlinks "s/allowed_hosts=127.0.0.1,::1/allowed_hosts=127.0.0.1,::1,192.168.1.71,centreon,centreon.tips-of-mine.lan/g" /etc/nagios/nrpe.cfg
echo ' -- Creation du fichier : centreon.cfg'
sudo mv /Vagrantfiles/centreon.cfg /etc/nrpe.d/centreon.cfg
echo ' -- Sauvegarde du fichier : snmpd.conf'
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
echo ' -- Creation du fichier : snmpd.conf'
sudo mv /Vagrantfiles/snmpd.conf /etc/snmp/snmpd.conf
echo ' -- Creation du fichier : snmpd.conf'
echo ' - daemon Service'
systemctl daemon-reload
echo ' - Demarrage des services'
systemctl enable snmpd && systemctl start snmpd
systemctl enable nrpe && systemctl start nrpe
echo ' - Installation Inventaire'
yum install fusioninventory-agent fusioninventory-agent-task-inventory -y
echo ' - Configuration Inventaire'
echo ' -- Creation du fichier : agent.cfg'
sudo mv /Vagrantfiles/agent.cfg /etc/fusioninventory/agent.cfg
echo ' - daemon Service'
systemctl daemon-reload
echo ' - Demarrage des services'
systemctl restart fusioninventory-agent && systemctl enable fusioninventory-agent
echo ' - Configuration SSH'
sed -i --follow-symlinks "s/#HostKey/HostKey/g" /etc/ssh/sshd_config
sed -i --follow-symlinks "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config
sed -i --follow-symlinks "s/UseDNS no/#UseDNS yes/g" /etc/ssh/sshd_config
echo '.'
echo '**********************'
echo '* INSTALLATION: Fin AdminTools'
echo '**********************'
echo '.'
echo '.'
echo '**********************'
echo '* INSTALLATION: Debut Gestion Disque'
echo '**********************'
echo '.'
echo ' - Configuration disque'
sudo fdisk -u /dev/sda<<EOF
p
d
2
n
p
2
t
2
8e
w
EOF
echo ' - Configuration disque LVM'
echo '===================================================================================================='
sudo partx -u /dev/sda
echo '===================================================================================================='
sudo pvresize /dev/sda2
echo '===================================================================================================='
sudo pvscan
echo '===================================================================================================='
sudo vgdisplay
echo '===================================================================================================='
sudo lvdisplay
echo '===================================================================================================='
sudo lvextend -l +100%FREE -r /dev/centos_centos7/root
echo '===================================================================================================='
echo '.'
echo '**********************'
echo '* INSTALLATION: Fin Gestion Disque'
echo '**********************'
echo '.'
echo '.'
echo '**********************'
echo '* INSTALLATION: Reboot'
echo '**********************'
echo '.'