Linux OCSNG Agent Installation instructions

Source: Internet
Author: User
Tags snmp root access


OCS Agent Linux Client One-click automated installation scripts for Debian and Redhat-class Linux systems.

Required software, 2 files:

Cacert.pem

This file is the root certificate of the CA, you can see "erecting CA Server for HTTPS communication, Web server using CA self-visa book with HTTPS communication http://990487026.blog.51cto.com/10133282/1686127"

Based on HTTPS communication, the Ipdiscover functionality of the OCS can be used.


-rw-r--r--. 1 root root 59M August 16:57 linux-ocs-agent.tar.gz

Link: http://pan.baidu.com/s/1pJKK4w7 Password: a0re



Ready go!

===================================================

Tar XF ocs_agent0812.1028.tar.gz

2, "Perform installation" "Without root access error, prompt with sudo su"
[Email protected]:/home# cd linux/
[Email protected]:/home/linux/#./install.sh
3, "Enter the machine's asset number, do not lose the wrong!" 】
Vobile:enter TAG on this machine:

The show successful! Indicates that the client installation was successful and the following shows the current minute of the machine.
successful!
57



#!/bin/bash# cacert.pem# deb.txt# yum packages# ocsinventory-agent# fix  cron time# fix sync time # if test ok,modify debug=0#  2015.08.14 fix redhat linux yum depend problems# 2015.08.14 fix  seting cron time# 2015.08.17 grep successful or break#export path=$ Path:.clearsetterm -blank 0root_id= ' id -u ' if [  $root _id -ne 0 ] ;  then{   clear   echo -e  "\033[40;37mwarning: you are  not root user ! \n\n[Please use Command line ]$ sudo  su \n\n \033[0m "   exit 10}fi#judenment operation os ************ rm -rf /etc/ocsinventory*      #rm  old  agent conf if [ -f /etc/redhat-release ]then    os=1elif [ -f /etc/debian_ version ]then    os=2else   clear    echo  "No  support operating system ! " fi# debian ********************************if [  $OS  -eq 2 ] ;thenecho   "Debian linux"  sleep 1cp /etc/apt/sources.list /etc/apt/sources.listbaksed  -i  ' 1r deb.txt '  /etc/apt/sources.listmkdir /etc/ocsinventory-agentcp -f ./ cacert.pem /etc/ocsinventory-agent/apt-get -y install ntpdate  dmidecode  libxml-simple-perl libnet-ip-perl libwww-perl perl libnet-ssleay-perl  libcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl  libproc-daemon-perl  Net-tools libsys-syslog-perl pciutils smartmontools read-edid nmap makestat= ' echo $? ' Clearcp -f /etc/apt/sources.listbak /etc/apt/sources.listfi# redhat  OS ********************************if [  $OS  -eq 1 ] ;thenecho  " redhat linux  "Sleep 1mkdir -p /etc/ocsinventory-agentcp -f ./cacert.pem  /etc/ocsinventory-agent/yum -y --nogpgcheck localinstall ./packages/*.rpmstat= ' Echo  $? ' fi# sync time ****************************************echo  ' Sync time ... " ntpdate 210.72.145.44ntpdate cn.pool.ntp.org# make && make install  if [  $stat  -eq 0 ] ;then # read  input parameter clearwhile [ 1 ]doecho -en  "\033[47;34;7mWarning:  enter tag  on this machine :\033[0m "Read tagleng1= ' echo ${tag} |  WC -L|BC '          if [  $leng 1 -lt 5 ]          then              clear               echo -e  "\033[40;36;7mwarning:tag more than 5 length.:\ 033[0m "         else              break        fidone# read  input time for cronwhile [ 1 ]do    echo -en   "\033[47;34;7mhello: how many hours do you want executive ocs  AGENT ?\033[0M [1-23]/ [2]?: "    read time1        if [ -z  "$time 1"  ];then       time1=2       fi         time2= ' ECHO ${TIME1} |BC '         if [  $time 2 -ge 1 -a  $time 2 -le 23 ]        then           time3= $time 2            break              else                   echo  "warning: input error ,please  Try again. "             fidonecd  ocsinventory-unix-agent-2.1.1make cleanenv perl_autoinstall=1 perl makefile.pl & & make && make install && perl postinst.pl --nowizard --remove-old-linux-agent -- server=https://your_ocsng-server_ip/ocsinventory --crontab --tag= $tag  --debug --logfile=/ etc/ocsinventory-agent/ocs.log --ca=/etc/ocsinventory-agent/cacert.pem --snmp --nowgrep  Cannot  /etc/ocsinventory-agent/ocs.log > /dev/null 2>&1stat2= ' echo $? ' else    clear    echo  ' warning:dependency relationship  no solution . "     exit 2fi# set for cron ************************************** if [  $stat 2 -ne 0 ] ;then clearecho   "Install  ocsinventory-agent  successful ! " sleep 2# modify ocsng agent conf.file debug=0sed -i  "s#debug=1#debug=0 #g " /etc/ocsinventory-agent/ocsinventory-aGent.cfga= ' date +%m ' b= ' echo  "$a" |BC ' sed -i  ' 2d '  /etc/cron.d/ocsinventory-agentecho   "$b  */$time 3 * * * root /usr/local/bin/ocsinventory-agent --lazy  > /dev/null 2>&1 " >> /etc/cron.d/ocsinventory-agentstat3= ' echo  $? '   if [  $stat 3 -eq 0 ] ;then    if [ $ os -eq 2 ] ;then  #debian     /etc/init.d/cron restart     stat4= ' echo $? '     fi    if [  $OS  -eq 1 ] ;then  #redHat     service crond reload     stat4= ' echo $? '     fi  fielse     clear    date    echo  "Warning:install error ,please  try again  [ . /install.sh ] "    exit 2fiif [  $stat 4 -eq 0 ] ; thenclearecho  "YOUR MACHINE TAG : $tag" grep debug=0 /etc/ocsinventory-agent/ ocsinventory-agent.cfgecho -en  "Install ocsinventory-agent successful!\n\nthe current  time:  "tail -n 1 /etc/cron.d/ocsinventory-agent | cut -d "   "  -f1else    clear    echo " Warning:cron error   "    exit 2   fi

======= One-click Automation installation Script ends ==============================================




Linux OCSNG Agent Installation instructions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.