Friday, February 25, 2011

Install OCS Inventory Agents minus the Headaches

One of the major hurdles with OCS Inventory is understanding how the wiki pages addresses agent installation methods.  In my opinion the best documentation they had so far is written in french! So what I am going to do is make life easier!  Posting a hashed version which will allow you to install agents with very little problem.  Enough of the talk and lets get down to business.

Before installing the agent it is pressumed that you have OCS Inventory Server running correctly.  The goal in this mini-cookbook is to guide you without having to second guess how the installation might proceed as with the OCS pages do.

[For those using Linux/MacOS]

1)  Download the package http://launchpad.net/ocsinventory-unix-agent/stable-1.1.2/ocsinventory-unix-agent-1.1.2.1/+download/Ocsinventory-Agent-1.1.2.1.tar.gz  if you want a source install, on the otherhand if you are using newer versions of Debian/CentOS you can easily do an apt-get install "package name" and yum install "package name" though you will have to make some edits to your repos list to update your channel streams

2)  Process will check for availability of "perl" modules for features to work correctly. Please satisfy those dependencies before continuing.

3) During installation you will have to point your agent to listen to e.g.  172.16.24.109 <-- server. It is expected that you will have a  problem connecting this is fine. Once the agent is installed please proceed to item 4.

4) Edit /etc/ocsinventory-agent/ocsinventory-agent.cfg

          e.g.
             basevardir=/var/lib/ocsinventory-agent
             tag=
             server=xxx.xxx.xxx.xxx  <-- change this value to point to the OCS server.

5) Initialize a check, issue the command:

              ocsinventory-agent --debug --info --scan-homedirs --server=xxx.xxx.xxx.xxx
    This will send an agent report to the server. If this is successful  please proceed to item 6.

6) Daemonize the agent

              ocsinventory-agent --deamon --debug --info --scan-homedirs --server=xxx.xxx.xxx.xxx


     This will put the agent to work in the background.

7) To automatically allow your system to send updates to the inventory server you will have to bootstrap the previous command "item 6" on startup.


[For those using Windows] 

1) Download the installer package:  http://launchpad.net/ocsinventory-windows-agent/trunk/win32-agent-release-4061/+download/OCSNG_WINDOWS_AGENT_4061.1.zip  extract and install the package.
Look for the file "OcsAgentSetup.exe" to run setup.

2) On the Server Address use this IP: 172.16.24.109; Server Port: 80; Enable log file [check it]; Immediately launch inventory [check it].

3) Check if the service is running. You can do this by opening the "service management console > services" double click on the icon and check if OCS INVENTORY is "started" and the Startup type is set to "Automatic" your done.

Process should not take more than 30 minutes of your time. Login to the web console of the OCS Inventory Server and verify that the agents communicated your machine and has been registered.

Thursday, February 24, 2011

Configuring Xymon for SMS Server Tools 3

I have done SMS configurations for a variety of monitoring tools in the past.  Nagios is one of them, however in this post we wont be dealing with nagios or any of those stuff related to nagios.  What we will be configuring is xymon/hobbit monitor to work with sms server tools 3.  If you notice, documentation from these two technologies are almost too stiff-straightforward and you have to do more than just read the man pages to get things done. 

The fun side in this tutorial is this; you will be re-using old and existing equipment to get the job done.  In my case I used an HSDPA modem to act as my SMS modem.  After that you will need an SMS gateway software to glue the entire project. 

Lets dig down to the details:

1. Configure your xymon server for mail notification alerts.  If you get alerts after a good configuration then you are ready to move foward with the next steps.

2. Download and install SMS Server Tools 3 http://smstools3.kekekasvi.com/packages/smstools3-3.1.14.tar.gz

3. Configure your modem to be detected by your system, it doesn't matter what NIX variant you are using.  In my case I used CentOS 5.5 to install and configure my HSDPA modem Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem.  It usually comes with a virtual cdrom and storage that can be detected by your system.  The goal here is remove those you dont need for you to use it only as a communication device.

4. Once you have installed SMS Server Tools 3 you will need to edit this file smsd.conf which can be located at /etc/smsd.conf and edit this line:
device=/dev/ttyS0 to device=/dev/ttyUSB1, save the file.

5. If you can see these lines from your tail log, it means you are doing good. 

$sudo /usr/bin/tail -f /var/log/smsd.log
2011-02-24 21:16:13,6, GSM1: Checking device for incoming SMS
2011-02-24 21:16:13,6, GSM1: Checking if modem is ready
2011-02-24 21:16:13,7, GSM1: -> AT
2011-02-24 21:16:13,7, GSM1: Command is sent, waiting for the answer
2011-02-24 21:16:13,7, GSM1: <- OK
2011-02-24 21:16:13,6, GSM1: Pre-initializing modem
2011-02-24 21:16:14,7, GSM1: -> ATE0+CMEE=1;+CREG=2
2011-02-24 21:16:14,7, GSM1: Command is sent, waiting for the answer
2011-02-24 21:16:14,7, GSM1: <- OK
2011-02-24 21:16:14,7, GSM1: -> AT+CSQ
2011-02-24 21:16:14,7, GSM1: Command is sent, waiting for the answer
2011-02-24 21:16:14,7, GSM1: <- +CSQ: 15,99 OK
2011-02-24 21:16:14,6, GSM1: Signal Strength Indicator: (15,99) -83 dBm (Good), Bit Error Rate: not known or not detectable
2011-02-24 21:16:14,6, GSM1: Checking if Modem is registered to the network

6. Test the sendsms binary, send a text message:  /usr/local/bin/sendsms 091781000102,  you should receive an sms message from your server.

7. Now you need to define the checks you need this will normally be equaivalent to the one you set for you email notification alerts In my case heres how it looks like:

SCRIPT /usr/local/bin/textalert FORMAT=sms
the "textalert" command is a simple bash script (or any scripting language you prefer would suffice) that handles the actual "sendsms" binary that actually sends out the messages. 

Done.  In the next post I will discuss escalations and other modifications necessary to make xymon work as you expect it to be.

This has been reposted to: http://www.howtoforge.com/node/6096