GithubHelp home page GithubHelp logo

microsoft / build-oms-agent-for-linux Goto Github PK

View Code? Open in Web Editor NEW
40.0 44.0 66.0 1.72 MB

Build projects required for omsagent

License: Other

Makefile 0.93% Shell 8.35% Batchfile 0.94% PowerShell 89.78%

build-oms-agent-for-linux's Introduction

Operations Management Suite Linux Agent

Table of Contents

If you are an active contributor to the OMS-Agent project, you should set up your system and follow our common workflow. New to git? Read guidelines for development.


Setting up a machine to build OMS

A "shell bundle" is a distribution mechanism for the OMS agent. A shell bundle is a shell script that has, as part of it, .RPM and .DEB native package files. The shell bundle determines what has to be installed based on system configuration and installs the appropriate packages.

There are two ways to build OMS.

  1. As an RPM or DEB package that can be installed on the local system, assuming all dependencies are met (most easily met if a shell bundle was previously installed to "seed" the system), or

  2. As a shell bundle.

Building a shell bundle is a superset of setting up a system to build a local RPM, so we will cover that first.

Sudoers configuration

Configure sudo

Dependencies to build a native package

Note that it's very nice to be able to use the updatedns project to use host names rather than IP numbers in a Hyper-V environment. On CentOS systems, this requires the bind-utils package (updatedns requires the 'dig' program). The bind-utils package isn't otherwise necessary.

  • On CentOS 7.x
 sudo yum install git bind-utils bison gcc-c++ rpm-devel pam-devel openssl-devel rpm-build mysql-devel cmake boost-devel boost-test audit-libs-devel unzip
  • On Ubuntu 14.04
 sudo apt-get install git pkg-config make bison g++ rpm librpm-dev libpam0g-dev libssl-dev libmysqlclient-dev cmake libboost-dev libboost-test-dev libaudit-dev libauparse-dev unzip

Install minimum version of Ruby (the system must have 1.9 or higher, but 2.2.6 is recommended). This is needed for all systems. This can be done with the following commands:

 wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.6.tar.gz
 tar xzvf ruby-2.2.6.tar.gz
 cd ruby-2.2.6
 ./configure
 make
 sudo make install
 $(which ruby) --version  # verify that this prints 2.2.6
  • Note on libboost

Libboost is not a runtime dependency. It is only needed to build and run the OMS-Auditd-Plugin unittests.

  • Notes on other platforms

When building a machine for ULINUX builds (such as CentOS 5.x), we suggest using the O/S distribution CD to install the packages. It's not as easy, but that's the only way to guarantee that packages aren't updated such that generated binaries are not backwards compatible. (See notes on building a shell bundle, elsewhere in this document.)

Also note that since you won't use 'yum', you must also handle the dependent packages manually (keep adding lines to the 'rpm install' command line until all dependencies are satisfied).

Similar methods would be utilized if building a Redhat system that is not registered for use for up2date.

Setting up a system to build a shell bundle

To build a shell bundle, we need and older Linux system (we typically use CentOS 5.0 for this), as binary images created with older Linux systems are generally upwards compatible when installed on newer Linux systems.

A notable exception: We use the OpenSSL package, and we can't tell if we need OpenSSL v1.0.x or OpenSSL v1.1.x. As a result, we have a special process to build both versions of OpenSSL that we can link against.

Once OpenSSL is set up, you need to configure omsagent to include the --enable-ulinux qualifier, like this:
./configure --enable-ulinux

Cloning the repositories

If you have read access to the OMS TestConfig project, use the following.

Otherwise, only run the first git clone command and refer to preparing system tests if you want them to be run.

git clone --recursive [email protected]:Microsoft/Build-OMS-Agent-for-Linux.git bld-omsagent
git clone [email protected]:Microsoft/OMS-Agent-for-Linux-testconfig.git bld-omsagent/omsagent/test/config

Note that there are several subprojects, and authentication is a hassle unless you set up an SSH key via your GitHub account. Set up your machine properly for a much easier workflow.

Preparing system tests

This section only applies if you do not have read access to OMS TestConfig project

System tests communicate with the server. They require keys which may not be published. You may obtain your own keys for free by creating an account on Microsoft Operations Management Suite then get the keys from the settings view.

Create the file bld-omsagent/omsagent/test/config/systest.conf with content like so:

export TEST_WORKSPACE_ID=<id>
export TEST_SHARED_KEY=<key>

export TEST_WORKSPACE_ID_2=<id>
export TEST_SHARED_KEY_2=<key>

export TEST_PROXY_SETTING="http://proxyuser:proxypass@host:8080"

Building omsagent

From the bld-omsagent directory (created above from 'git clone', do the following:

cd omsagent/build
./configure
make
make test

Note that the configure script takes a variety of options. You can use configure --help to see the options available.

When the build completes, you should have a native package that you can install on your system. The native package should be in a subdirectory off of bld-omsagent/omsagent/target (the directory name varies based on debug vs. release builds).

As mentioned above, this form of build requires a shell bundle to be installed to "seed" your system with other required dependencies.

Note that the build will build multiple versions of Ruby (one for unit test, only built once, even after "make distclean"), and then one or two versions depending if you're building for a shell bundle or not. Bottom line: The first build is always slower than subsequent builds.

Troubleshooting

Improper clone of project

If you get an error during the Ruby build like:

downloader.rb:180: private method `class_variable_set' called for Downloader:Class (NoMethodError)
configure: error: cannot run /bin/sh tool/config.sub
make: *** [/usr/local/ruby-2.2.0a] Error 127

While this points to an issue where your system version of Ruby is too old (strangely enough, Ruby is required to build Ruby), the root source of the issue is that you didn't clone the repository recursively. Please read the section on cloning the repositories for details on how to clone the repository.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

build-oms-agent-for-linux's People

Contributors

aaronrm avatar abenbachir avatar adishiritwick avatar amitsara avatar andyleejordan avatar assing avatar ayushlimaye avatar bt avatar canfikret avatar dinavolu-ms avatar dmohanta avatar hestolz avatar jamiemagee avatar jeffaco avatar krmanupa avatar lagalbra avatar narinem avatar nikhim-um avatar niroyb avatar phlang-ms avatar redsquirrelious avatar robbiezhang avatar schneiderl avatar shpimpal avatar simathih avatar sw47 avatar swjai avatar taglines avatar timorenz-msft avatar vakaranamsft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

build-oms-agent-for-linux's Issues

Problem with system center agent discovery

I built omsagent on a RHEL7 s390x server. After some code adjustements required by this architecture, I successfully built auoms, scx, omi and omsagent. rpms.

I then performed a manual installation of these rpms. Everything went smoothly, except for some SELinux policy that failed to install. Since SELinux is disabled on my server, I don't think I should matter about it...

I now have the following process running:

/opt/omi/bin/omiserver -d
/opt/omi/bin/omiengine -d --logfilefd 3 --socketpair 9

Now, when I try to perform a discover of this agent from system center, it fails and I can see the following errors from /var/opt/omi/log/omiagent.root.root.log

2018/11/28 14:25:01 [15104,15104] WARNING: null(0): EventId=30042 Priority=WARNING cannot open shared library: {/opt/omi/lib/libSCXCoreProviderModule.so}: /opt/omi/lib/libSCXCoreProviderModule.so: undefined symbol:
_ZN12SCXSystemLib22SystemInfoDependencies9CallCPUIDENS_13CpuIdFunctionERNS_9RegistersE
2018/11/28 14:25:01 [15104,15104] WARNING: null(0): EventId=30041 Priority=WARNING cannot open shared library: {SCXCoreProviderModule}: SCXCoreProviderModule: cannot open shared object file: No such file or directory
2018/11/28 14:25:01 [15104,15104] WARNING: null(0): EventId=30065 Priority=WARNING failed to open provider library: SCXCoreProviderModule
2018/11/28 14:25:01 [15104,15104] ERROR: null(0): EventId=20001 Priority=ERROR Agent _RequestCallback: ProvMgr_NewRequest failed with result 1 !

Any idea on how to solve this would be welcome!

Access denied to one of the sub-projects

The instructions mention that if I don't have access to the "OMS TestConfig" repo I should only run the first git clone. However, even there I get denied access to another repository:

$git clone --recursive [email protected]:Microsoft/Build-OMS-Agent-for-Linux.git bld-omsagent
Cloning into 'bld-omsagent'...
...
Checking connectivity... done.
Submodule 'auoms' ([email protected]:Microsoft/OMS-Auditd-Plugin.git) registered for path 'auoms'
Submodule 'dsc' ([email protected]:Microsoft/PowerShell-DSC-for-Linux.git) registered for path 'dsc'
Submodule 'omi' ([email protected]:Microsoft/omi.git) registered for path 'omi'
Submodule 'omsagent' ([email protected]:Microsoft/OMS-Agent-for-Linux.git) registered for path 'omsagent'
Submodule 'opsmgr' ([email protected]:Microsoft/SCXcore.git) registered for path 'opsmgr'
Submodule 'opsmgr-kits' ([email protected]:Microsoft/SCXcore-osskits.git) registered for path 'opsmgr-kits'
Submodule 'pal' ([email protected]:Microsoft/pal.git) registered for path 'pal'
Cloning into '/Users/andre/work/vc/bld-omsagent/auoms'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:Microsoft/OMS-Auditd-Plugin.git' into submodule path '/Users/andre/work/vc/bld-omsagent/auoms' failed

How to build the omsconfig package?

In the released omsagent-1.2.0-148.universal.x64.sh, it installs omi, scx, omsagent, and omsconfig packages.
I followed the steps in Readme to build omsagent package on Ubuntu 14.04, and it comes out deb packages of omi, scx, and omsagent. Then how to build the omsconfig package?

And when I install the built packages one by one, installing omsagent package outputs a log:
-su: /opt/microsoft/omsconfig/Scripts/OMS_MetaConfigHelper.py: No such file or directory
Is it normal behavior?

OMS Agent should build on Linux ARM (32 bit or 64 bit) but fails

I've tried building this source on Rasbpian on a Pi B 3+ (32 bit) and on Ubuntu 64 bit (Pi 4.) I've gotten interesting failures both times:

I wanted an OMS Agent and syslog daemon running at home for a test Sentinel instance. All I have these days are Raspberry Pis. Note that these instructions assume some Linux/Unix familiarity. I may make the instructons a bit more "universal" and easily read at a later date.

  1. I stated with Raspbian on a Pi B 3+. If you're using Ubuntu you may be able to skip some of these steps because Raspbian is a hair different as it aims to be more lightweight.
  2. Change /bin/sh to link to /bin/bash instead of /bin/dash. (cd /bin; rm sh; ln -s bash sh) The ./configure shell scripts expect specific POSIX behaviour which dash doesn't have.
  3. Install GNU-awk (apt install gawk) and change /usr/bin/awk to link to /usr/bin/gawk. Again, ./configure scripts expect GNU-awk behaviour.
  4. Follow the instructions here to use 'git clone' to get the latest codebsae to your Pi: https://github.com/microsoft/Build-OMS-Agent-for-Linux
  5. In addition to the packages listed in that repository you may need to install: libpam-dev, libgss-dev, and ruby.
  6. From the instructions from the "master" branch URL above create the bld-omsagent/omsagent/test/config/systest.conf file.
  7. Cross fingers and run "make." I was dumb and didn't time this, but you're looking at well over an hour.
  8. -- I'm still dealing with a compile issue. Ruby itself seems to compile (why can't we just use the one installed on the system?) When Ruby goes to "========================= Performing Moving Ruby to intermediate directory" it craps out, complaining it can't find "ruby/config.h" ... some RTFM shows that "-I/home/pi/oms/bld-omsagent/omsagent/intermediate/Linux_ULINUX_1.0_UNKNOWN_64_Release/ruby/include/ruby-2.6.0/armv7l-linux-eabihf" is missing from the command line. When I add that, the compile fails badly as the default options complain that casting warnings should be treated as errors.

... so I tried again, this time on a Pi 4 running 64 Bit Ubuntu Server.
On the initial configure run it falied; I had to add 7 lines to bld-omsagent/omsagent/Unix/buildtool so that "aarch64" was a supported architecture, but still didn't get far.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.