{"id":794,"date":"2014-04-13T01:54:51","date_gmt":"2014-04-13T04:54:51","guid":{"rendered":"http:\/\/www.viazap.com.br\/?p=794"},"modified":"2014-04-13T02:10:46","modified_gmt":"2014-04-13T05:10:46","slug":"inventario-like-a-boss-com-ocs-server","status":"publish","type":"post","link":"https:\/\/blog.clusterweb.com.br\/?p=794","title":{"rendered":"Invent\u00e1rio &#8220;like a boss&#8221; com OCS Server"},"content":{"rendered":"<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n<tbody>\n<tr>\n<td colspan=\"2\"><b>Introdu\u00e7\u00e3o<\/b><\/p>\n<div>O\u00a0<em>OCS<\/em>\u00a0\u00e9 um software livre que permite aos usu\u00e1rios deste servi\u00e7o criar invent\u00e1rios de toda a sua estrutura de TI. Ele coleta informa\u00e7\u00f5es tanto do hardware quanto do software das m\u00e1quinas da rede que utilizam seu client. Todo o resultado desta busca \u00e9 visualizada em sua interface Web.O OCS \u00e9 dividido em 3 partes:<\/p>\n<ul>\n<li>Server;<\/li>\n<li>Agente;<\/li>\n<li>Interface Web.<\/li>\n<\/ul>\n<p>O Server utiliza-se das tecnologias PERL de programa\u00e7\u00e3o, servidor Web\u00a0<em>Apache<\/em>\u00a0e banco de dados\u00a0<em>MySQL<\/em>, sendo assim, o OCS \u00e9 multiplataforma funcionando tanto em UNIXs quanto em Microsoft Windows.<\/p>\n<p>Os agentes respons\u00e1veis pela coleta de informa\u00e7\u00f5es tamb\u00e9m s\u00e3o multiplataformas e podem ser instalados em:<\/p>\n<ul>\n<li>Microsoft Windows;<\/li>\n<li><a href=\"http:\/\/www.vivaolinux.com.br\/linux\/\">GNU\/Linux<\/a>;<\/li>\n<li>Mac OS X;<\/li>\n<li>Sun Solaris;<\/li>\n<li>IBM AIX;<\/li>\n<li>FreeBSD, NetBSD, OpenBSD;<\/li>\n<li>HP-UX;<\/li>\n<li>Android.<\/li>\n<\/ul>\n<p>A interface Web, escrita em PHP, \u00e9 respons\u00e1vel pela visualiza\u00e7\u00e3o dos dados encontrados.<\/p>\n<h1>Instalando as depend\u00eancias<\/h1>\n<p>Instalando o reposit\u00f3rio EPEL:<\/p>\n<p><strong># rpm -Uvh http:\/\/fedora.uib.no\/epel\/6\/x86_64\/epel-release-6-7.noarch.rpm<\/strong><\/p>\n<p>Instalando os pacotes:<\/p>\n<p><strong># yum install perl-XML-Simple perl-Net-SNMP perl-Compress-Zlib perl-Net-IP perl-LWP* perl-Digest-MD4* perl-Net-SSLeay perl-DBI perl-DBD-MySQL perl-Apache-DBI perl-SOAP-Lite perl-XML-Entities perl-Crypt-SSLeay perl-Proc-Daemon perl-Proc-PID-File perl-ExtUtils-MakeMaker perl-YAML perl-XML-SAX-Base mod_perl cpan libvirt -y &#8211;skip-broken<\/strong><\/p>\n<p># cpan<br \/>\ncpan&gt;\u00a0<strong>install ExtUtils::MakeMaker<\/strong><\/p>\n<p>Configurando o banco de dados:<\/p>\n<p><strong># mysql<\/strong><br \/>\n&gt;\u00a0<strong>create database OCS character set utf8;<\/strong><br \/>\n&gt;\u00a0<strong>grant all privileges on OCS.* to ocs@localhost identified by &#8216;ocs&#8217;;<\/strong><br \/>\n&gt;\u00a0<strong>flush privileges;<\/strong><\/p>\n<p>Instalando o OCS Server:<\/p>\n<p><strong># wget<\/strong>\u00a0<a href=\"https:\/\/launchpad.net\/ocsinventory-server\/stable-2.0\/2.0.5\/+download\/OCSNG_UNIX_SERVER-2.0.5.tar.gz\">https:\/\/launchpad.net\/ocsinventory-server\/stable-2.0\/2.0.5\/+download\/OCSNG_UNIX_SERVER-2.0.5.tar.gz<\/a><br \/>\n<strong># tar -zxvf OCSNG_UNIX_SERVER-2.0.5.tar.gz<br \/>\n# cd OCSNG_UNIX_SERVER-2.0.5\/<br \/>\n# .\/setup.sh<\/strong><\/p>\n<p>Obs.: Aceitar todas as configura\u00e7\u00f5es padr\u00e3o de instala\u00e7\u00e3o.<!--more--><\/p>\n<p>Alterar o caminho dos arquivos PHP est\u00e1ticos no raiz do Web Server, SNMP e Discovery.<\/p>\n<p>Exemplo:<\/p>\n<blockquote><p>&#8220;Where to copy Administration Server static files for PHP Web Console<br \/>\n[\/usr\/share\/ocsinventory-reports] ?\/var\/www\/html<\/p>\n<p>OK, using directory \/var\/www\/html to install static files \ud83d\ude09<br \/>\nWhere to create writable\/cache directories for deployement packages,<br \/>\nIPDiscover and SNMP [\/var\/lib\/ocsinventory-reports] ?\/var\/www\/html<\/p><\/blockquote>\n<p>Alterar o arquivo &#8220;z-ocsinventory-server.conf&#8221;:<\/p>\n<p><strong># vim \/etc\/httpd\/conf.d\/z-ocsinventory-server.conf<\/strong><\/p>\n<div># Master Database settings<br \/>\n# Replace localhost by hostname or ip of MySQL server for WRITE<br \/>\nPerlSetEnv OCS_DB_HOST localhost<br \/>\n# Replace 3306 by port where running MySQL server, generally 3306<br \/>\nPerlSetEnv OCS_DB_PORT 3306<br \/>\n# Name of database<br \/>\nPerlSetEnv OCS_DB_NAME OCS<br \/>\nPerlSetEnv OCS_DB_LOCAL OCS<br \/>\n# User allowed to connect to database<br \/>\nPerlSetEnv OCS_DB_USER ocs<br \/>\n# Password for user<br \/>\nPerlSetVar OCS_DB_PWD ocs<\/div>\n<p>E tamb\u00e9m alterar o arquivo &#8220;ocsinventory-reports.conf&#8221;:<\/p>\n<p><strong># vim \/etc\/httpd\/conf.d\/ocsinventory-reports.conf<\/strong><\/p>\n<div># Some PHP tuning for deployement feature up to 8 MB<br \/>\n# post_max_size must be greater than upload_max_filesize<br \/>\n# because of HTTP headers<br \/>\nphp_value post_max_size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0201m<br \/>\nphp_value upload_max_filesize\u00a0\u00a0\u00a0\u00a0200m<\/div>\n<p>Reiniciar o servi\u00e7o\u00a0<em>httpd<\/em>:<\/p>\n<p><strong># \/etc\/init.d\/httpd restart<\/strong><br \/>\nOu:<br \/>\n<strong># service httpd restart<\/strong><\/p>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>Configura\u00e7\u00e3o do OCS<\/b><\/p>\n<div>Criar pasta\u00a0<em>scripts\/oscxml<\/em>:<strong># mkdir -p \/scripts\/ocsxml<\/strong><\/p>\n<p>Acessar o endere\u00e7o da interface Web do OCS Server: &lt;ip_do_servidor&gt;\/ocsreports<\/p>\n<div><a href=\"http:\/\/img.vivaolinux.com.br\/imagens\/artigos\/comunidade\/1352211731.img01.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" alt=\"Linux: Invent\u00e1rio 'like a boss' com OCS Server\" src=\"http:\/\/img.vivaolinux.com.br\/imagens\/artigos\/comunidade\/thumb_1352211731.img01.png\" width=\"200\" height=\"99\" border=\"0\" \/><\/a><\/div>\n<p>Completar com as informa\u00e7\u00f5es corretas e clicar em: Send<\/p>\n<div><a href=\"http:\/\/img.vivaolinux.com.br\/imagens\/artigos\/comunidade\/1352211731.img02.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/img.vivaolinux.com.br\/imagens\/artigos\/comunidade\/thumb_1352211731.img02.png\" width=\"500\" height=\"250\" border=\"0\" \/><\/a><\/div>\n<p>Se a sa\u00edda for semelhante \u00e0 imagem acima, est\u00e1 tudo OK! Voc\u00ea pode digitar novamente o endere\u00e7o da interface Web.<\/p>\n<p>Entre com o nome de usu\u00e1rio e senha:<\/p>\n<ul>\n<li>Usu\u00e1rio: admin<\/li>\n<li>Senha: admin<\/li>\n<\/ul>\n<div><a href=\"http:\/\/img.vivaolinux.com.br\/imagens\/artigos\/comunidade\/1352211731.img03.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/img.vivaolinux.com.br\/imagens\/artigos\/comunidade\/thumb_1352211731.img03.png\" width=\"500\" height=\"245\" border=\"0\" \/><\/a><\/div>\n<p>Esta \u00e9 a &#8216;cara&#8217; do OCS!<\/p>\n<p>V\u00e1 em:<\/p>\n<p>Configura\u00e7\u00f5es \u2192 Interface<\/p>\n<p>E modifique conforme abaixo:<\/p>\n<div>LOCAL_URI_SERVER: Customize &gt; http:\/\/127.0.0.1\/ocsreportsDOWNLOAD_PACK_DIR: BY DEFAULT<\/p>\n<p>IPDISCOVER_IPD_DIR: BY DEFAULT<\/p>\n<p>TODO O RESTO: BY DEFAULT<\/p>\n<\/div>\n<p>Aplique as configura\u00e7\u00f5es.<\/p>\n<p>V\u00e1 em:<\/p>\n<p>Configura\u00e7\u00f5es \u2192 Arquivo de Invent\u00e1rio<\/p>\n<p>E modifique conforme abaixo (seguir ordem):<\/p>\n<ol>\n<li>ON<\/li>\n<li>OCS<\/li>\n<li>OFF<\/li>\n<li>OCS_FILES_PATH: \/scripts\/ocsxml<\/li>\n<\/ol>\n<p>Aplique as configura\u00e7\u00f5es.<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>Instalando e configurando o agente OCS<\/b><\/p>\n<div>Execute os seguintes comandos para termos certeza que os servi\u00e7os est\u00e3o funcionando e colocando os devidos na inicializa\u00e7\u00e3o:<strong># \/etc\/init.d\/messagebus restart<br \/>\n# \/etc\/init.d\/avahi-daemon restart<br \/>\n# \/etc\/init.d\/libvirtd restart<br \/>\n# \/sbin\/chkconfig messagebus on<br \/>\n# \/sbin\/chkconfig avahi-daemon on<\/strong><\/p>\n<p>Baixar o agente:<\/p>\n<p><strong># wget<\/strong>\u00a0<a href=\"https:\/\/launchpad.net\/ocsinventory-unix-agent\/stable-2.0\/2.0.5\/+download\/Ocsinventory-Unix-Agent-2.0.5.tar.gz\">https:\/\/launchpad.net\/ocsinventory-unix-agent\/stable-2.0\/2.0.5\/+download\/Ocsinventory-Unix-Agent-2.0.5.tar.gz<\/a><\/p>\n<p>Descompactar:<\/p>\n<p><strong># tar -zxvf Ocsinventory-Unix-Agent-2.0.5.tar.gz<\/strong><\/p>\n<p>Acessar a pasta:<\/p>\n<p><strong># cd Ocsinventory-Unix-Agent-2.0.5\/<\/strong><\/p>\n<p>Compilar:<\/p>\n<p><strong># perl Makefile.PL<br \/>\n# make<br \/>\n# make install<\/strong><\/p>\n<p>Seguir desta forma:<\/p>\n<blockquote><p>enter<br \/>\n2<br \/>\nenter<br \/>\nhttp:\/\/&lt;ip_do_server&gt;\/ocsinventory<br \/>\nenter<br \/>\nenter<br \/>\nTAG: colocar a TAG (ex.: SERVER)<br \/>\nenter<br \/>\nenter<br \/>\nenter<br \/>\nenter<br \/>\nenter<br \/>\nenter<br \/>\nenter<br \/>\nSuccess!<\/p><\/blockquote>\n<p>Para enviar os dados para o server, execute o comando abaixo:<\/p>\n<p><strong># ocsinventory-agent &#8211;server http:\/\/&lt;ip_do_server&gt;\/ocsinventory &#8211;debug &#8211;force<\/strong><\/p>\n<p>\u00c9 interessante agendar para que os &#8220;clients&#8221; nos envie, toda hora, uma carga de invent\u00e1rio para o nosso server. Para isso, podemos agendar este comando na\u00a0<em>cron<\/em>:<\/p>\n<div>00 * * * * root ocsinventory-agent &#8211;server http:\/\/&lt;ip_do_server&gt;\/ocsinventory &#8211;debug &#8211;force<\/div>\n<p>Obrigado! Espero ter agregado algo a voc\u00eas.<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Introdu\u00e7\u00e3o O\u00a0OCS\u00a0\u00e9 um software livre que permite aos usu\u00e1rios deste servi\u00e7o criar invent\u00e1rios de toda a sua estrutura de TI. Ele coleta informa\u00e7\u00f5es tanto do hardware quanto do software das m\u00e1quinas da rede que utilizam seu client. Todo o resultado desta busca \u00e9 visualizada em sua interface Web.O OCS \u00e9 dividido em 3 partes: Server; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1,42,51],"tags":[532,533,534],"class_list":["post-794","post","type-post","status-publish","format-standard","hentry","category-viazap","category-leitura-recomendada","category-linux-linuxrs","tag-inventario","tag-like-a-boss","tag-ocs-server"],"_links":{"self":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=794"}],"version-history":[{"count":2,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/794\/revisions"}],"predecessor-version":[{"id":796,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/794\/revisions\/796"}],"wp:attachment":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}