Система инвентаризации

Тут описывается нелёгкий путь настройки ОС FreeBSD, начиная с установки дистрибутива и заканчивая настройкой каждого сервиса
Ответить
RomA
Сообщения: 358
Зарегистрирован: 05 авг 2008, 14:53
Контактная информация:

Система инвентаризации

Сообщение RomA »

В качестве системы инвентаризации мы будем использовать OCS Inbentory http://www.ocsinventory-ng.org/en/ - ниего лучше я пока что не видел - найдете - с радостью рассмотрю ваши предложения.
Ну так вот. На момент написания статьи на сайте заявлена версия 2.0 в то время как в портах 1.3.3. Она наверняка там когда то появится и тогда можно будет просто поставить с портов, но пока что я буду описывать как это сделать руками.

Мне не хочется искать все зависимости, потому я сначало поставлю то, что есть, дабы порт потянул за собой все нужные программки

Код: Выделить всё

unix# cd /usr/ports/net-mgmt/ocsinventory-ng
unix# make install clean


У меня на сервере практически ничего ещё не стоит - потому вопросов он мне назадавал много:

Код: Выделить всё

                      ┌────────────────────────────────────────────────────────────────────┐
                      │                 Options for mysql-client 5.5.12                    │  
                      │ ┌────────────────────────────────────────────────────────────────┐ │  
                      │ │          [X] OPENSSL  Enable SSL support                       │ │  
                      │ │          [ ] FASTMTX  Replace mutexes with spinlocks           │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      ├─└────────────────────────────────────────────────────────────────┘─┤  
                      │                       [  OK  ]       Cancel                        │  
                      └────────────────────────────────────────────────────────────────────┘  
                      ┌────────────────────────────────────────────────────────────────────┐
                      │                  Options for p5-DBD-mysql 4.019                    │  
                      │ ┌────────────────────────────────────────────────────────────────┐ │  
                      │ │              [ ] SSL  build with OpenSSL support               │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      ├─└────────────────────────────────────────────────────────────────┘─┤  
                      │                       [  OK  ]       Cancel                        │  
                      └────────────────────────────────────────────────────────────────────┘  
                      ┌────────────────────────────────────────────────────────────────────┐
                      │                   Options for p5-libwww 5.837                      │  
                      │ ┌────────────────────────────────────────────────────────────────┐ │  
                      │ │                 [ ] SSL  Enable https support                  │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      ├─└────────────────────────────────────────────────────────────────┘─┤  
                      │                       [  OK  ]       Cancel                        │  
                      └────────────────────────────────────────────────────────────────────┘  
                      ┌────────────────────────────────────────────────────────────────────┐
                      │                   Options for php5-mysql 5.3.6                     │  
                      │ ┌────────────────────────────────────────────────────────────────┐ │  
                      │ │              [X] MYSQLND  Use MySQL Native Driver              │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      ├─└────────────────────────────────────────────────────────────────┘─┤  
                      │                       [  OK  ]       Cancel                        │  
                      └────────────────────────────────────────────────────────────────────┘  
                                                                                              
                      ┌────────────────────────────────────────────────────────────────────┐
                      │                    Options for php5-gd 5.3.6                       │  
                      │ ┌────────────────────────────────────────────────────────────────┐ │  
                      │ │     [X] T1LIB     Include T1lib support                        │ │  
                      │ │     [X] TRUETYPE  Enable TrueType string function              │ │  
                      │ │     [ ] JIS       Enable JIS-mapped Japanese font support      │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      │ │                                                                │ │  
                      ├─└────────────────────────────────────────────────────────────────┘─┤  
                      │                       [  OK  ]       Cancel                        │  
                      └────────────────────────────────────────────────────────────────────┘  

В процессе было видно что стало много нужных и перловых и php-шных модулей - они нужны, но сама же старая вебморда нам не нужна, потому удаляем

Код: Выделить всё

unix# cd /usr/ports/net-mgmt/ocsinventory-ng
unix# make deinstall
===>  Deinstalling for net-mgmt/ocsinventory-ng
===>   Deinstalling ocsinventory-ng-1.3.3
Но ещё не всё что нужно поставилось, потому доставим остальное руками

Код: Выделить всё

unix# cd /usr/ports/www/p5-Apache-DBI-mp2
unix# make install clean
unix# cd /usr/ports/textproc/p5-XML-Entities
unix# make install clean
Скачиваем последнюю версию с сайта производителя и распаковываем

Код: Выделить всё

unix# cd /usr/local/install
unix# fetch http://launchpadlibrarian.net/71381405/OCSNG_UNIX_SERVER-2.0.tar.gz
OCSNG_UNIX_SERVER-2.0.tar.gz                  100% of 6199 kB 1746 kBps
unix# 
unix# tar -xzf OCSNG_UNIX_SERVER-2.0.tar.gz
В создавшейся папке есть описание и файл автоустановки - давайте в него посмотрим и сделаем выводы - в самом начале у нас идут параметры соединения с базой данных - запоминаем
Теперь самое время запустить этот скрипт и ответить на его вопросы

Код: Выделить всё

unix# ./setup.sh

+----------------------------------------------------------+
|                                                          |
| Welcome to OCS Inventory NG Management server setup !    |
|                                                          |
+----------------------------------------------------------+

Trying to determine whitch OS or Linux distribution you use
+----------------------------------------------------------+
| Checking for Apache web server binaries !                |
+----------------------------------------------------------+

CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and
previous, please remove any Apache configuration for Communication Server!

Do you wish to continue ([y]/n)?y
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.

Starting OCS Inventory NG Management server setup from folder /usr/local/install/OCSNG_UNIX_SERVER-2.0
Storing log in file /usr/local/install/OCSNG_UNIX_SERVER-2.0/ocs_server_setup.log

+----------------------------------------------------------+
| Checking for database server properties...               |
+----------------------------------------------------------+

Your MySQL client seems to be part of MySQL version 5.5.
Your computer seems to be running MySQL 4.1 or higher, good ;-)

Which host is running database server [localhost] ?
OK, database server is running on host localhost ;-)

On which port is running database server [3306] ?
OK, database server is running on port 3306 ;-)


+----------------------------------------------------------+
| Checking for Apache web server daemon...                 |
+----------------------------------------------------------+

Where is Apache daemon binary [/usr/local/sbin/httpd] ?
OK, using Apache daemon /usr/local/sbin/httpd ;-)


+----------------------------------------------------------+
| Checking for Apache main configuration file...           |
+----------------------------------------------------------+

Where is Apache main configuration file [/usr/local/etc/apache22/httpd.conf] ?
OK, using Apache main configuration file /usr/local/etc/apache22/httpd.conf ;-)


+----------------------------------------------------------+
| Checking for Apache user account...                      |
+----------------------------------------------------------+

Which user account is running Apache web server [User] ?www
OK, Apache is running under user account www ;-)


+----------------------------------------------------------+
| Checking for Apache group...                             |
+----------------------------------------------------------+

Which user group is running Apache web server [www] ?
OK, Apache is running under users group www ;-)


+----------------------------------------------------------+
| Checking for Apache Include configuration directory...   |
+----------------------------------------------------------+

Setup found Apache Include configuration directory in
.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [] ?/usr/local/etc/apache22/Includes
OK, Apache Include configuration directory /usr/local/etc/apache22/Includes found ;-)


+----------------------------------------------------------+
| Checking for PERL Interpreter...                         |
+----------------------------------------------------------+

Found PERL Intrepreter at </usr/bin/perl> ;-)
Where is PERL Intrepreter binary [/usr/bin/perl] ?
OK, using PERL Intrepreter /usr/bin/perl ;-)


Do you wish to setup Communication server on this computer ([y]/n)?


+----------------------------------------------------------+
| Checking for Make utility...                             |
+----------------------------------------------------------+

OK, Make utility found at </usr/bin/make> ;-)

+----------------------------------------------------------+
| Checking for Apache mod_perl version...                  |
+----------------------------------------------------------+

Checking for Apache mod_perl version 1.99_22 or higher
Found that mod_perl version 1.99_22 or higher is available.
OK, Apache is using mod_perl version 1.99_22 or higher ;-)

+----------------------------------------------------------+
| Checking for Communication server log directory...       |
+----------------------------------------------------------+

Communication server can create detailled logs. This logs can be enabled
by setting interger value of LOGLEVEL to 1 in Administration console
menu Configuration.
Where to put Communication server log directory [/var/log/ocsinventory-server] ?
OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-)


+----------------------------------------------------------+
| Checking for required Perl Modules...                    |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for Apache::DBI PERL module...
Found that PERL module Apache::DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for Compress::Zlib PERL module...
Found that PERL module Compress::Zlib is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.

+----------------------------------------------------------+
| Checking for optional Perl Modules...                    |
+----------------------------------------------------------+

Checking for SOAP::Lite PERL module...
Found that PERL module SOAP::Lite is available.
Checking for XML::Entities PERL module...
Found that PERL module XML::Entities is available.


+----------------------------------------------------------+
| OK, looks good ;-)                                       |
|                                                          |
| Configuring Communication server Perl modules...         |
+----------------------------------------------------------+

Checking if your kit is complete...
Looks good
Writing Makefile for Apache::Ocsinventory

+----------------------------------------------------------+
| OK, looks good ;-)                                       |
|                                                          |
| Preparing Communication server Perl modules...           |
+----------------------------------------------------------+


+----------------------------------------------------------+
| OK, prepare finshed ;-)                                  |
|                                                          |
| Installing Communication server Perl modules...          |
+----------------------------------------------------------+


+----------------------------------------------------------+
| OK, Communication server Perl modules install finished;-)|
|                                                          |
| Creating Communication server log directory...           |
+----------------------------------------------------------+

Creating Communication server log directory /var/log/ocsinventory-server.

Fixing Communication server log directory files permissions.
*** WARNING Please configure log rotation for files in /var/log/ocsinventory-server


+----------------------------------------------------------+
| OK, Communication server log directory created ;-)       |
|                                                          |
| Now configuring Apache web server...                     |
+----------------------------------------------------------+

To ensure Apache loads mod_perl before OCS Inventory NG Communication Server,
Setup can name Communication Server Apache configuration file
'z-ocsinventory-server.conf' instead of 'ocsinventory-server.conf'.
Do you allow Setup renaming Communication Server Apache configuration file
to 'z-ocsinventory-server.conf' ([y]/n) ?y
OK, using 'z-ocsinventory-server.conf' as Communication Server Apache configuration file
Removing old communication server configuration to file /usr/local/etc/apache22/Includes/ocsinventory.conf
Writing communication server configuration to file /usr/local/etc/apache22/Includes/z-ocsinventory-server.conf

+----------------------------------------------------------+
| OK, Communication server setup sucessfully finished ;-)  |
|                                                          |
| Please, review /usr/local/etc/apache22/Includes/z-ocsinventory-server.conf
| to ensure all is good. Then restart Apache daemon.       |
+----------------------------------------------------------+


Do you wish to setup Administration Server (Web Administration Console)
on this computer ([y]/n)?y

+----------------------------------------------------------+
| Checking for Administration Server directories...        |
+----------------------------------------------------------+

CAUTION: Setup now install files in accordance with Filesystem Hierarchy
Standard. So, no file is installed under Apache root document directory
(Refer to Apache configuration files to locate it).
If you're upgrading from OCS Inventory NG Server 1.01 and previous, YOU
MUST REMOVE (or move) directories 'ocsreports' and 'download' from Apache
root document directory.
If you choose to move directory, YOU MUST MOVE 'download' directory to
Administration Server writable/cache directory (by default
/var/lib/ocsinventory-reports), especialy if you use deployement feature.

Do you wish to continue ([y]/n)?y
Assuming directories 'ocsreports' and 'download' removed from
Apache root document directory.

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?/usr/home/www/proxy
OK, using directory /usr/home/www/proxy to install static files ;-)
Where to create writable/cache directories for deployement packages,
IPDiscover and SNMP [/var/lib/ocsinventory-reports] ?
OK, writable/cache directory is /var/lib/ocsinventory-reports ;-)


+----------------------------------------------------------+
| Checking for required Perl Modules...                    |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.

+----------------------------------------------------------+
| Installing files for Administration server...            |
+----------------------------------------------------------+

Creating PHP directory /usr/home/www/proxy/ocsreports.
Copying PHP files to /usr/home/www/proxy/ocsreports.
Fixing permissions on directory /usr/home/www/proxy/ocsreports.
Creating database configuration file /usr/home/www/proxy/ocsreports/dbconfig.inc.php.
Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
Fixing permissions on directory /var/lib/ocsinventory-reports/ipd.
Creating packages directory /var/lib/ocsinventory-reports/download.
Fixing permissions on directory /var/lib/ocsinventory-reports/download.
Creating packages directory /var/lib/ocsinventory-reports/snmp.
Fixing permissions on directory /var/lib/ocsinventory-reports/snmp.
Configuring snmp_com.txt file
Configuring IPDISCOVER-UTIL Perl script.
Installing IPDISCOVER-UTIL Perl script.
Fixing permissions on IPDISCOVER-UTIL Perl script.
Writing Administration server configuration to file /usr/local/etc/apache22/Includes/ocsinventory-reports.conf

+----------------------------------------------------------+
| OK, Administration server installation finished ;-)      |
|                                                          |
| Please, review /usr/local/etc/apache22/Includes/ocsinventory-reports.conf
| to ensure all is good and restart Apache daemon.         |
|                                                          |
| Then, point your browser to http://server//ocsreports
| to configure database server and create/update schema.   |
+----------------------------------------------------------+


Setup has created a log file /usr/local/install/OCSNG_UNIX_SERVER-2.0/ocs_server_setup.log. Please, save this file.
If you encounter error while running OCS Inventory NG Management server,
we can ask you to show us his content !

DON'T FORGET TO RESTART APACHE DAEMON !

Enjoy OCS Inventory NG ;-)

unix# 
Нам посоветовали перезапустить апач, чем мы и займемся, только сначала подправим его конфигурационный файл /usr/local/etc/apache22/httpd.conf - внача файла в соответствующую секцию мы добавляем загрузку модуля

Код: Выделить всё

LoadModule perl_module        libexec/apache22/mod_perl.so
, а так же проверяем что бы была раскоментирована следующая строка в сааамом конце файла

Код: Выделить всё

Include etc/apache22/Includes/*.conf
и перезапускаем апач

Код: Выделить всё

unix# /usr/local/etc/rc.d/apache22 stop
Stopping apache22.
Waiting for PIDS: 73781.

unix# /usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.

unix#
Идём на вебморду http://192.168.7.2/ocsreports/ вы должны что-то увидеть.
1.jpg
1.jpg (86.11 КБ) 14080 просмотров
Оговорюсь, что у вас должен стоять mysql сервер - если не стоит - ставьте - http://corp.stniva.ru/forum/viewtopic.p ... 86&start=0, если же стоит - переходим к настройкам
2.jpg
2.jpg (35.13 КБ) 14080 просмотров
3.jpg
3.jpg (115.71 КБ) 14080 просмотров
4.jpg
4.jpg (76.2 КБ) 14080 просмотров
5.jpg
5.jpg (31.28 КБ) 14080 просмотров
Если вы успешно зашли - то пока что всё у вас правильно :-) Система стоит и готова принимать данные
RomA
Сообщения: 358
Зарегистрирован: 05 авг 2008, 14:53
Контактная информация:

Установка клиентов

Сообщение RomA »

Вообще как ставить клиента хорошо и много описано тут http://wiki.ocsinventory-ng.org/index.p ... ndowsAgent
В данном случае мы рассмотрим установку при помощи логон-скриптов и домена.
В нетлогоне /usr/home/samba/netlogon создаём скрипт с именем ocs.bat и следующим содержанием:

Код: Выделить всё

@echo off

REM *********** Declare variables *********************************************
REM *********** Adjust to your situation **************************************
SET Version=2.0.0.20
REM имя или IP сервера где установлен OCSNG
SET Server=http://192.168.7.2/ocsinventory
REM путь к папке на расшареном ресурсе, который доступен всем компьютерам домена
SET SetupPath=\\192.168.6.2\netlogon

REM *********** Install if agent isn't found **********************************
IF EXIST "%PROGRAMFILES%\OCS Inventory agent\OCSInventory.exe" GOTO update
:install.
%SetupPath%\OcsAgentSetup.exe /S /SERVER=%Server% /NP /ssl=0 /proxy_type=0 /TAG=%username% /NOW /DEBUG.
GOTO version

:update
REM *********** Update agent if %Version%.txt isn't found *********************
IF EXIST "%PROGRAMFILES%\OCS Inventory agent\%Version%.txt" GOTO end
:upgrade
%SetupPath%\OcsAgentSetup.exe /S /SERVER=%Server% /NP /ssl=0 /proxy_type=0 /TAG=%username% /NOW /UPGRADE /DEBUG.

:version
cd /D "%PROGRAMFILES%\OCS Inventory agent\"
echo pwouet > %Version%.txt

:end
REM *********** Cleanup variables *********************************************
SET Version=
SET Server=
Несколько замечаний:
1) скрипт надо создавать из-под винды
2) прописываем туда свои данные, пути и ИП адреса

Теперь нам надо не забыть положить тот файлик, что описан у нас в скрипте - он находится в дистрибутиве агента и качается о официального сайта

Код: Выделить всё

unix# cd /usr/local/install
unix# fetch http://launchpadlibrarian.net/71377414/OCSNG-Windows-Agent-2.0.zip
OCSNG-Windows-Agent-2.0.zip                   100% of 4609 kB 1757 kBps

unix# unzip OCSNG-Windows-Agent-2.0.zip 
Archive:  OCSNG-Windows-Agent-2.0.zip
   creating: OCSNG-Windows-Agent-2.0/
  inflating: OCSNG-Windows-Agent-2.0/AUTHORS.TXT  
  inflating: OCSNG-Windows-Agent-2.0/CHANGELOG  
  inflating: OCSNG-Windows-Agent-2.0/LICENSE.TXT  
  inflating: OCSNG-Windows-Agent-2.0/OCS-NG-Windows-Agent-Setup.exe  
  inflating: OCSNG-Windows-Agent-2.0/OcsLogon.exe  
  inflating: OCSNG-Windows-Agent-2.0/READ CAREFULLY OCS Inventory NG Agent for Windows Documentation.url  

unix# cp /usr/local/install/OCSNG-Windows-Agent-2.0/OCS-NG-Windows-Agent-Setup.exe /usr/home/samba/netlogon/OcsAgentSetup.exe

unix#  
Надо прописать этот скрипт в наш logon.bat что бы он выполнялся - добавляем строку

Код: Выделить всё

start /b \\192.168.7.2\netlogon\ocs.bat
Перезагружаем компьютер, входим в домен (обычному пользователю никто ничего поставить не разрешит, потому надо входить под привелегированным пользователем) - должен поставиться агент - его иконка появится в трее, а в вебинтерфейсе появится запись о компьюторе
1.jpg
1.jpg (117.24 КБ) 14075 просмотров
Кликнув на имя компьютера можно посмотреть его расширенную информацию
2.jpg
2.jpg (84.33 КБ) 14075 просмотров
Сам агент поселяется в трее и живёт там и отправляет данные при любом пользователи. Кликнув по нём правой кнопкой мышки можно отправить данные принудительно
3.jpg
3.jpg (21.81 КБ) 14075 просмотров
Они отправленные (совсем не факт что дошли!!! - это когда отладку делать будите - учтите)
4.jpg
4.jpg (15.04 КБ) 14075 просмотров
Можно посмотреть и инфу по компьютеру
5.jpg
5.jpg (112.95 КБ) 14075 просмотров
Ну а вот я залогинился на этот же комп под пользователем - система отреагировала и изменила имя в новом отчете
6.jpg
6.jpg (32.41 КБ) 14075 просмотров
Scorp
Сообщения: 22
Зарегистрирован: 16 янв 2009, 14:19

Re: Система инвентаризации

Сообщение Scorp »

в портах теперь новая версия есть 2.0, после ее установки дистрибутив окажется в /usr/local/share/ocsinventory-ng/ и от туда уже так же можно установить через setup.sh
OleG
Сообщения: 2
Зарегистрирован: 11 янв 2009, 16:45

Re: Система инвентаризации

Сообщение OleG »

Чтоб начал сервер принимать отчеты от агентов, дать права на базу ocsweb
mysql> GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocs'@'localhost' IDENTIFIED BY 'ocs';
Vitamin
Сообщения: 14
Зарегистрирован: 02 мар 2010, 13:50
Контактная информация:

Re: Система инвентаризации

Сообщение Vitamin »

by RomA:
Есть у меня подозрения, что потом такую фрю фиг обновишь, потому что модули будут мешаться - надо проверить
UP:
Проверил. Не то что не обновляется, а даже потом проги не ставятся корректно... Данный совет ломает принцип работы FreeBSD. Не советую так делать - лучше найдите нужный порт
при установке выползал маленький "косячёк" с установкой модулей перла.
Выглядел он воттак

Код: Выделить всё

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for Apache::DBI PERL module...
Found that PERL module Apache::DBI is available.
Checking for DBD::mysql PERL module...
*** ERROR: PERL module DBD::mysql is not installed !
Checking for Compress::Zlib PERL module...
Found that PERL module Compress::Zlib is available.
Checking for XML::Simple PERL module...
*** ERROR: PERL module XML::Simple is not installed !
Checking for Net::IP PERL module...
*** ERROR: PERL module Net::IP is not installed !
*** ERROR: There is one or more required PERL modules missing on your computer !
Please, install missing PERL modules first.
боролся с этим командой

Код: Выделить всё

cpan -e ИМЯ МОДУЛЯ
Имя модуля это - XML::Simple и т.д.

Крайне не советую так делать (с) RomA
RomA
Сообщения: 358
Зарегистрирован: 05 авг 2008, 14:53
Контактная информация:

Установка из портов - Система инвентаризации

Сообщение RomA »

Данная статья приведена только для ознакомления. Вы должны осознавать с какими трудностями можете столкнуться при последующем обновлении программ, установленных таким образом

Задача:
Установить самую последнюю версию системы инвентаризации

Подготовка:
1) Идём на сайт http://www.ocsinventory-ng.org и смотри какая последняя версия (2.1)
2) Идём в порты и смотрим какая последняя версия там (2.0.5)
3) Идём на сайт http://www.freshports.org и проверяем - есть ли новая версия (нет)

Составление плана:
Приинимая во внимание тот факт, что поставить надо версию, отсутствующую в портывх и то, что руками мы уже ставили новую версию - то придумаем что нить новенькое и поставим из портов
1) Создание своего порта
2) Установка
3) Настройка и работа

Решение:
Итак, первым делом склонируем имеющийся порт

Код: Выделить всё

stat# cd /usr/ports/net-mgmt
stat# cp -R ./ocsinventory-ng ./ocsinventory-ng1
И переходим в новый каталог

Код: Выделить всё

stat# cd ./ocsinventory-ng1
теперь в файле Makefile правим версию

Код: Выделить всё

PORTVERSION=   2.1
Больше я ничего не правил, хотя надо было бы поправить зависимости, но у меня уже стоял нужный пакет, так что...
Кставти, поставьте и себе его

Код: Выделить всё

stat# cd /usr/ports/net/p5-Apache2-SOAP/
stat# make install clean
ну да вернёмся к нашим баранам в нашу директорию - правим следующий файл distinfo

Код: Выделить всё

SHA256 (OCSNG_UNIX_SERVER-2.1.tar.gz) = 9affbb8b7b42142feb9239dd79b1c84d00def383c929da0ac11261ff368d42a6
SIZE (OCSNG_UNIX_SERVER-2.1.tar.gz) = 2892907
Теперь немного о том, где я взял эту информацию.
Сам файл был скачан в директорию /usr/ports/distfiles по сылке на официальносм сайте

Код: Выделить всё

stat# fetch https://launchpadlibrarian.net/165057074/OCSNG_UNIX_SERVER-2.1.tar.gz
а потом с него и были сняты размеры

Код: Выделить всё

stat# ls -l OCSNG_UNIX_SERVER-2.1.tar.gz 
-rw-r--r--  1 root  wheel  2892907 Feb  5 19:27 OCSNG_UNIX_SERVER-2.1.tar.gz

stat# sha256 OCSNG_UNIX_SERVER-2.1.tar.gz 
SHA256 (OCSNG_UNIX_SERVER-2.1.tar.gz) = 9affbb8b7b42142feb9239dd79b1c84d00def383c929da0ac11261ff368d42a6

stat# 
ну вот и всё - порт создан - можно ставить как обычно

Код: Выделить всё

stat# make install clean
После того, как всё поставится надо сделать первоначальные настройки и скопировать скриптики куда надо

Код: Выделить всё

stat# cd /usr/local/share/ocsinventory-ng
stat# ./setup.sh
это уже знакомый нам скрипт, который не буду слишком детально описывать, а лиш приведу листинг как ставил я
stat# ./setup.sh

+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management server setup ! |
| |
+----------------------------------------------------------+

Trying to determine whitch OS or Linux distribution you use
+----------------------------------------------------------+
| Checking for Apache web server binaries ! |
+----------------------------------------------------------+

CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and
previous, please remove any Apache configuration for Communication Server!

Do you wish to continue ([y]/n)?y
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.

Starting OCS Inventory NG Management server setup from folder /usr/local/share/ocsinventory-ng
Storing log in file /usr/local/share/ocsinventory-ng/ocs_server_setup.log

+----------------------------------------------------------+
| Checking for database server properties... |
+----------------------------------------------------------+

Your MySQL client seems to be part of MySQL version 5.6.
Your computer seems to be running MySQL 4.1 or higher, good ;-)

Which host is running database server [localhost] ?
OK, database server is running on host localhost ;-)

On which port is running database server [3306] ?
OK, database server is running on port 3306 ;-)


+----------------------------------------------------------+
| Checking for Apache web server daemon... |
+----------------------------------------------------------+

Where is Apache daemon binary [/usr/local/sbin/httpd] ?
OK, using Apache daemon /usr/local/sbin/httpd ;-)


+----------------------------------------------------------+
| Checking for Apache main configuration file... |
+----------------------------------------------------------+

Where is Apache main configuration file [/usr/local/etc/apache22/httpd.conf] ?
OK, using Apache main configuration file /usr/local/etc/apache22/httpd.conf ;-)


+----------------------------------------------------------+
| Checking for Apache user account... |
+----------------------------------------------------------+

Which user account is running Apache web server [User] ?www
OK, Apache is running under user account www ;-)


+----------------------------------------------------------+
| Checking for Apache group... |
+----------------------------------------------------------+

Which user group is running Apache web server [www] ?
OK, Apache is running under users group www ;-)


+----------------------------------------------------------+
| Checking for Apache Include configuration directory... |
+----------------------------------------------------------+

Setup found Apache Include configuration directory in
.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [] ?/usr/local/etc/apache22/Includes
OK, Apache Include configuration directory /usr/local/etc/apache22/Includes found ;-)


+----------------------------------------------------------+
| Checking for PERL Interpreter... |
+----------------------------------------------------------+

Found PERL Intrepreter at </usr/bin/perl> ;-)
Where is PERL Intrepreter binary [/usr/bin/perl] ?
OK, using PERL Intrepreter /usr/bin/perl ;-)


Do you wish to setup Communication server on this computer ([y]/n)?


+----------------------------------------------------------+
| Checking for Make utility... |
+----------------------------------------------------------+

OK, Make utility found at </usr/bin/make> ;-)

+----------------------------------------------------------+
| Checking for Apache mod_perl version... |
+----------------------------------------------------------+

Checking for Apache mod_perl version 1.99_22 or higher
Found that mod_perl version 1.99_22 or higher is available.
OK, Apache is using mod_perl version 1.99_22 or higher ;-)

+----------------------------------------------------------+
| Checking for Communication server log directory... |
+----------------------------------------------------------+

Communication server can create detailled logs. This logs can be enabled
by setting interger value of LOGLEVEL to 1 in Administration console
menu Configuration.
Where to put Communication server log directory [/var/log/ocsinventory-server] ?
OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-)


+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for Apache::DBI PERL module...
Found that PERL module Apache::DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for Compress::Zlib PERL module...
Found that PERL module Compress::Zlib is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.

+----------------------------------------------------------+
| Checking for optional Perl Modules... |
+----------------------------------------------------------+

Checking for SOAP::Lite PERL module...
Found that PERL module SOAP::Lite is available.
Checking for XML::Entities PERL module...
Found that PERL module XML::Entities is available.


+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Configuring Communication server Perl modules... |
+----------------------------------------------------------+

Writing Makefile for Apache::Ocsinventory
Writing MYMETA.yml and MYMETA.json

+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Preparing Communication server Perl modules... |
+----------------------------------------------------------+


+----------------------------------------------------------+
| OK, prepare finshed ;-) |
| |
| Installing Communication server Perl modules... |
+----------------------------------------------------------+


+----------------------------------------------------------+
| OK, Communication server Perl modules install finished;-)|
| |
| Creating Communication server log directory... |
+----------------------------------------------------------+

Creating Communication server log directory /var/log/ocsinventory-server.

Fixing Communication server log directory files permissions.
*** WARNING Please configure log rotation for files in /var/log/ocsinventory-server
Configuring logrotate for Communication server.
Removing old communication server logrotate file /etc/logrotate.d/ocsinventory-NG
Writing communication server logrotate to file /etc/logrotate.d/ocsinventory-server


+----------------------------------------------------------+
| OK, Communication server log directory created ;-) |
| |
| Now configuring Apache web server... |
+----------------------------------------------------------+

To ensure Apache loads mod_perl before OCS Inventory NG Communication Server,
Setup can name Communication Server Apache configuration file
'z-ocsinventory-server.conf' instead of 'ocsinventory-server.conf'.
Do you allow Setup renaming Communication Server Apache configuration file
to 'z-ocsinventory-server.conf' ([y]/n) ?
OK, using 'z-ocsinventory-server.conf' as Communication Server Apache configuration file
Removing old communication server configuration to file /usr/local/etc/apache22/Includes/ocsinventory.conf
Writing communication server configuration to file /usr/local/etc/apache22/Includes/z-ocsinventory-server.conf

+----------------------------------------------------------+
| OK, Communication server setup sucessfully finished ;-) |
| |
| Please, review /usr/local/etc/apache22/Includes/z-ocsinventory-server.conf
| to ensure all is good. Then restart Apache daemon. |
+----------------------------------------------------------+


Do you wish to setup Administration Server (Web Administration Console)
on this computer ([y]/n)?

+----------------------------------------------------------+
| Checking for Administration Server directories... |
+----------------------------------------------------------+

CAUTION: Setup now install files in accordance with Filesystem Hierarchy
Standard. So, no file is installed under Apache root document directory
(Refer to Apache configuration files to locate it).
If you're upgrading from OCS Inventory NG Server 1.01 and previous, YOU
MUST REMOVE (or move) directories 'ocsreports' and 'download' from Apache
root document directory.
If you choose to move directory, YOU MUST MOVE 'download' directory to
Administration Server writable/cache directory (by default
/var/lib/ocsinventory-reports), especialy if you use deployement feature.

Do you wish to continue ([y]/n)?
Assuming directories 'ocsreports' and 'download' removed from
Apache root document directory.

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?/usr/home/www
OK, using directory /usr/home/www to install static files ;-)

Where to create writable/cache directories for deployement packages,
administration console logs, IPDiscover [/var/lib/ocsinventory-reports] ?
OK, writable/cache directory is /var/lib/ocsinventory-reports ;-)


+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.

+----------------------------------------------------------+
| Installing files for Administration server... |
+----------------------------------------------------------+

Creating PHP directory /usr/home/www/ocsreports.
Copying PHP files to /usr/home/www/ocsreports.
Fixing permissions on directory /usr/home/www/ocsreports.
Creating database configuration file /usr/home/www/ocsreports/dbconfig.inc.php.
Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
Fixing permissions on directory /var/lib/ocsinventory-reports/ipd.
Creating packages directory /var/lib/ocsinventory-reports/download.
Fixing permissions on directory /var/lib/ocsinventory-reports/download.
Creating Administration server log files directory /var/lib/ocsinventory-reports/logs.
Fixing permissions on directory /var/lib/ocsinventory-reports/logs.
Creating Administration server scripts log files directory /var/lib/ocsinventory-reports/scripts.
Fixing permissions on directory /var/lib/ocsinventory-reports/scripts.
Configuring IPDISCOVER-UTIL Perl script.
Installing IPDISCOVER-UTIL Perl script.
Fixing permissions on IPDISCOVER-UTIL Perl script.
Writing Administration server configuration to file /usr/local/etc/apache22/Includes/ocsinventory-reports.conf

+----------------------------------------------------------+
| OK, Administration server installation finished ;-) |
| |
| Please, review /usr/local/etc/apache22/Includes/ocsinventory-reports.conf
| to ensure all is good and restart Apache daemon. |
| |
| Then, point your browser to http://server//ocsreports
| to configure database server and create/update schema. |
+----------------------------------------------------------+


Setup has created a log file /usr/local/share/ocsinventory-ng/ocs_server_setup.log. Please, save this file.
If you encounter error while running OCS Inventory NG Management server,
we can ask you to show us his content !

DON'T FORGET TO RESTART APACHE DAEMON !

Enjoy OCS Inventory NG ;-)


stat#
на что надо обратить внимание:
1) Пути (я поменял всего пару)
2) Перловые модули (он говорит какие не установленны)

Вот и всё - установка завершена - требуется настроить.

Настройка:
Ну этот процесс уже описан и ничем не отличается, напомню основные моменты:
1) Включить в конфиг апача перловый модуль, а то не будет принимать от клиентов инфу
2) Перезагурзить апачь с новыми конфигами и инклудами
3) Отсетить на вопросы вебморды - там ничего заковыристого
4) Не забыть дать права на папку а так же прописать в апаче (ну там перегрузить, помним, да?)

Код: Выделить всё

stat# chown -R www:www /usr/home/www/ocsreports

Код: Выделить всё

<VirtualHost *:80>
    ServerAdmin roman@stniva.ru
    DocumentRoot "/usr/home/www/ocsreports/"
    ServerName inv.stniva.ru
    ErrorLog "/var/log/httpd/inv-error_log"
    CustomLog "/var/log/httpd/inv-access_log" common
    <Directory "/usr/home/www/inv/">
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
Ну вот и всё. Мы создали свой порт, что бы руками не распихивать файлики. Собрали и установили его.
Спасибо за внимание. Удачи :-)
RomA
Сообщения: 358
Зарегистрирован: 05 авг 2008, 14:53
Контактная информация:

Установка Агента инвенторизации на FreeBSD

Сообщение RomA »

Будем идти уже известным способом - Скачаем последний дистряб, создадим порт и установим.

Скачиваем

Код: Выделить всё

stat# cd /usr/ports/distfiles
stat# fetch https://launchpadlibrarian.net/165090262/Ocsinventory-Unix-Agent-2.1.tar.gz
Ocsinventory-Unix-Agent-2.1.tar.gz            100% of 1806 kB 1168 kBps 00m02s

stat#  
Получаем данные

Код: Выделить всё

stat# ls -l Ocsinventory-Unix-Agent-2.1.tar.gz
-rw-r--r--  1 root  wheel  1849476 Feb  6 01:58 Ocsinventory-Unix-Agent-2.1.tar.gz
stat# sha256 Ocsinventory-Unix-Agent-2.1.tar.gz
SHA256 (Ocsinventory-Unix-Agent-2.1.tar.gz) = e99502c446e69c129436bff4b0dcf1dab7169c9b106cd425a7990935076dd369
stat#
Теперь идём в порты и делаем клон порта

Код: Выделить всё

stat# cd /usr/ports/net-mgmt
stat# cp -R ./ocsinventory-agent ./ocsinventory-agent1
Переходим в новую директорию и вписываем аши правки
в Makefile

Код: Выделить всё

PORTVERSION= 2.1
в distinfo

Код: Выделить всё

SHA256 (Ocsinventory-Unix-Agent-2.1.tar.gz) = e99502c446e69c129436bff4b0dcf1dab7169c9b106cd425a7990935076dd369
SIZE (Ocsinventory-Unix-Agent-2.1.tar.gz) = 1849476
После чего можно приступать к установке

Код: Выделить всё

stat# make install clean
У меня с установкой не возникло никаких проблем.

Теперь Агента надо натсроить, для чего ответим на ряд вопросов скрипта конфигурации

Код: Выделить всё

stat# /usr/local/lib/perl5/site_perl/5.16/Ocsinventory/Unix/postinst.pl
Не буду расписывать всё подробно - оно итак понятно - приведу только листинг как я отвечал на вопросы конфигуратора
Do you want to configure the agent
Please enter 'y' or 'n'?> [y]
Where do you want to write the configuration file?
0 -> /etc/ocsinventory
1 -> /usr/local/etc/ocsinventory
2 -> /etc/ocsinventory-agent
?> 1
Should the old linux_agent settings be imported ?
Please enter 'y' or 'n'?> [y]
[info] The config file will be written in /usr/local/etc/ocsinventory/ocsinventory-agent.cfg,
What is the address of your ocs server?> 192.168.0.6
Do you need credential for the server? (You probably don't)
Please enter 'y' or 'n'?> [n]
Do you want to apply an administrative tag on this machine
Please enter 'y' or 'n'?> [y]
tag?> Stat
Where do you want the agent to store its files? (You probably don't need to change it)?> [/var/lib/ocsinventory-agent]
Should I remove the old linux_agent
Please enter 'y' or 'n'?> [n]
Do you want to activate debug configuration option ?
Please enter 'y' or 'n'?> [y] n
Do you want to use OCS Inventory NG UNix Unified agent log file ?
Please enter 'y' or 'n'?> [y] n
Do you want disable SSL CA verification configuration option (not recommended) ?
Please enter 'y' or 'n'?> [n]
Do you want to set CA certificate chain file path ?
Please enter 'y' or 'n'?> [y] n
Do you want to use OCS-Inventory software deployment feature?
Please enter 'y' or 'n'?> [y] n
Do you want to use OCS-Inventory SNMP scans feature?
Please enter 'y' or 'n'?> [y] n
Do you want to send an inventory of this machine?
Please enter 'y' or 'n'?> [y]
Setting OCS Inventory NG server address...
Looking for OCS Invetory NG Unix Unified agent installation...
ocsinventory agent presents: /usr/local/bin/ocsinventory-agent
Creating /usr/local/etc/ocsinventory directory...
Writing OCS Inventory NG Unix Unified agent configuration
Use of uninitialized value in concatenation (.) or string at /usr/local/lib/perl5/site_perl/5.16/Ocsinventory/Unix/postinst.pl line 368, <STDIN> line 16.
Creating /var/lib/ocsinventory-agent/http:__192.168.0.6_ocsinventory directory...
Activating modules if needed...
Launching OCS Inventory NG Unix Unified agent...
sysctl: unknown oid 'hw.serialno'
-> Success!
New settings written! Thank you for using OCS Inventory
Вот и всё :-)

PS: Знаю что не хорошо так плодить порты, но версия 2.0.5, которая была в портах не выводила чать данных о системе в инвентаризацию. В частности не было частоты процессора - теперь есть :-)
Ответить