cs

Startup, Computer Science, Software, System Admin, Database

check_smartmon_ad12 NRPE: Unable to read output

Posted by cs on March 29th, 2012

Get following error when run

/usr/local/libexec/nagios/check_nrpe2 -H 10.10.10.1  -c check_smartmon_ad12

NRPE: Unable to read output

http://www.freebsddiary.org/nrpe-unable-to-read-output-followup.php

16 Rules To Operate a Business

Posted by cs on August 25th, 2011

1. Get and stay out of your comfort zone.

I believe that not much happens of any significance when we're in our comfort zone. I hear people say, "But I'm concerned about security." My response to that is simple: "Security is for cadavers." Never stop investing. Never stop improving. Never stop doing something new. The moment you stop improving your organization, it starts to die. Make it your goal to be better each and every day, in some small way. Remember the Japanese concept of Kaizen. Small daily improvements eventually result in huge advantages.

2. Never give up.

Almost nothing works the first time it's attempted.  Just because what you're doing does not seem to be working, doesn't mean it won't work. 

It just means that it might not work the way you're doing it.  If it was easy, everyone would be doing it, and you wouldn't have an opportunity.

3. When you're ready to quit, you're closer than you think.

There's an old Chinese saying that I just love, and I believe it is so true.  It goes like this: "The temptation to quit will be greatest just before you are about to succeed."

4. With regard to whatever worries you, not only accept the worst thing that could happen, but make it a point to quantify what the worst thing could be.

Very seldom will the worst consequence be anywhere near as bad as a cloud of "undefined consequences." 

My father would tell me early on, when I was struggling and losing my shirt trying to get Parsons Technology going, "Well, Robert, if it doesn't work, they can't eat you."

5. Focus on what you want to have happen.

Remember that old saying, "As you think, so shall you be."

6. Take things a day at a time.

No matter how difficult your situation is, you can get through it if you don't look too far into the future, and focus on the present moment. 

You can get through anything one day at a time.

7. Always be moving forward.

Never stop investing. Never stop improving. Never stop doing something new. The moment you stop improving your organization, it starts to die.

Make it your goal to be better each and every day, in some small way. Remember the Japanese concept of Kaizen. Small daily improvements eventually result in huge advantages.

8. Be quick to decide.

Remember what General George S. Patton said: "A good plan violently executed today is far and away better than a perfect plan tomorrow."

9. Measure everything of significance.

I swear this is true. Anything that is measured and watched, improves.

10. Anything that is not managed will deteriorate.

If you want to uncover problems you don't know about, take a few moments and look closely at the areas you haven't examined for a while.

I guarantee you problems will be there.

11. Pay attention to your competitors, but pay more attention to what you're doing.

When you look at your competitors, remember that everything looks perfect at a distance.

Even the planet Earth, if you get far enough into space, looks like a peaceful place.

12. Never let anybody push you around.

In our society, with our laws and even playing field, you have just as much right to what you're doing as anyone else, provided that what you're doing is legal.

13. Never expect life to be fair.

Life isn't fair. You make your own breaks. You'll be doing good if the only meaning fair has to you, is something that you pay when you get on a bus (i.e., fare).

14. Solve your own problems.

You'll find that by coming up with your own solutions, you'll develop a competitive edge. Masura Ibuka, the co-founder of SONY, said it best: "You never succeed in technology, business, or anything by following the others."

There's also an old Asian saying that I remind myself of frequently. It goes like this: "A wise man keeps his own counsel."

15. Don't take yourself too seriously.

Lighten up. Often, at least half of what we accomplish is due to luck. None of us are in control as much as we like to think we are.

16. There's always a reason to smile.

Find it. After all, you're really lucky just to be alive. Life is short.

More and more, I agree with my little brother. He always reminds me: "We're not here for a long time, we're here for a good time!"

How to Install Adobe Reader 8.1.1 on Debian Linux

Posted by cs on January 30th, 2008

First you need to download Adobe Reader 8.1.1 from here or here

Now you have AdobeReader_enu-8.1.1-1.i386.deb package you need to install this .deb package using the following command

#dpkg -i AdobeReader_enu-8.1.1-1.i386.deb

set up debian autofs

Posted by cs on January 22nd, 2008

1. #apt-get install autofs

cat /proc/mounts  // to check the current mounting situation, mount a mount point/device twice will fail

edit /etc/auto.master

/home/myfolder     /etc/auto.myfolder         --timeout=60

vim /etc/auto.myfolder

*    -rw,intr,rsize=32768,wsize=32768,tcp server:/home/myfolder/&

/etc/init.d/autofs restart

Zune install error XML Lite couldn’t be found

Posted by cs on January 2nd, 2008

When I tried to install Zune on my XP, I keep getting the error:

Installation Media Not found, The meida for installation package 'XML Lite' couldn't be found, it might be incomplete ot corrupt Error code: 0x80070002

To solve the problem, download 'XML Lite' from Microsoft site  After I installed the XMLLite, the error goes away.

Tal Metal

Posted by cs on December 5th, 2007

Introduction

This is a simple reference guide to the TAL and TALES languages.  Formal language specifications are hosted by Zope: TAL, TALES, and METAL.

TAL Commands

TAL consists of seven different commands (highest priority first): define, condition, repeat, content, replace, attributes, and omit-tag.  Commands are attributes on HTML or XML tags, e.g.

Article goes here

tal:define

Syntax: tal:define="[local | global] name expression [; define-expression...]

Description: Sets the value of "name" to "expression".  By default the name will be applicable in the "local" scope, which consists of this tag, and all other tags nested inside this tag.  If the "global" keyword is used then this name will keep its value for the rest of the document.

Example:

tal:condition

Syntax: tal:condition="expression"

Description:  If the expression evaluates to true then this tag and all its children will be output.  If the expression evaluates to false then this tag and all its children will not be included in the output.

Example:

Welcome to this page!

tal:repeat

Syntax: tal:repeat="name expression"

Description:  Evaluates "expression", and if it is a sequence, repeats this tag and all children once for each item in the sequence.  The "name" will be set to the value of the item in the current iteration, and is also the name of the repeat variable.  The repeat variable is accessible using the TAL path: repeat/name and has the following properties:

  1. index - Iteration number starting from zero
  2. number - Iteration number starting from one
  3. even - True if this is an even iteration
  4. odd - True if this is an odd iteration
  5. start - True if this is the first item in the sequence
  6. end - True if this is the last item in the sequence.  For iterators this is never true
  7. length - The length of the sequence.  For iterators this is maxint as the length of an iterator is unknown
  8. letter - The lower case letter for this iteration, starting at "a"
  9. Letter - Upper case version of letter
  10. roman - Iteration number in Roman numerals, starting at i
  11. Roman - Upper case version of roman

Example:



tal:content

Syntax: tal:content="[text | structure] expression"

Description:  Replaces the contents of the tag with the value of "expression".  By default, and if the "text" keyword is present, then the value of the expression will be escaped as required (i.e. characters "&<> will be escaped).  If the "structure" keyword is present then the value will be output with no escaping performed.

Example:

tal:replace

Syntax: tal:replace="[text | structure] expression"

Description: Behaves identically to tal:content, except that the tag is removed from the output (as if tal:omit-tag had been used).

Example:

Welcome

tal:attributes

Syntax: tal:attributes="name expression[;attributes-expression]"

Description:  Evaluates each "expression" and replaces the tag's attribute "name".  If the expression evaluates to nothing then the attribute is removed from the tag.  If the expression evaluates to default then the original tag's attribute is kept.  If the "expression" requires a semi-colon then it must be escaped by using ";;".

Example: Your Homepage

tal:omit-tag

Syntax: tal:omit-tag="expression"

Description: Removes the tag (leaving the tags content) if the expression evaluates to true.  If expression is empty then it is taken as true.

Example: Welcome to this page!

TALES Expressions

The expressions used in TAL are called TALES expressions.  The simplest TALES expression is a path which references a value, e.g. page/body references the body property of the page object.

path

Syntax: [path:]string[|TALES Expression]

Description: A path, optionally starting with the modifier 'path:', references a property of an object.  The '/' delimiter is used to end the name of an object and the start of the property name.  Properties themselves may be objects that in turn have properties.  The '|' ("or") character is used to find an alternative value to a path if the first path evaluates to 'Nothing' or does not exist.

Example:

There are several built in paths that can be used in paths:

  1. nothing - acts as None in Python
  2. default - keeps the existing value of the node (tag content or attribute value)
  3. options - the dictionary of values passed to the template (through the Context __init__ method)
  4. repeat - access the current repeat variable (see tal:repeat)
  5. attrs - a dictionary of original attributes of the current tag
  6. CONTEXTS - a dictionary containing all of the above

exists

Syntax: exists:path

Description: Returns true if the path exists, false otherwise.  This is particularly useful for removing tags from output when the tags will have no content.

Example:

nocall

Syntax: nocall:path

Description: Returns a reference to a path, but without evaluating the path.  Useful when you wish to define a new name to reference a function, not the current value of a function.

Example:

not

Syntax: not:tales-path

Description: Returns the inverse of the tales-path.  If the path returns true, not:path will return false.

Example:

Welcome to the site!

string

Syntax: string:text

Description:  Evaluates to a literal string with value text while substituting variables with the form ${pathName} and $pathName

Example:

python

Syntax: python:python-code

Description:  Evaluates the python-code and returns the result.  The python code must be properly escaped, e.g. "python: 1 < 2" must be written as "python: 1 < 2".  The python code has access to all Python functions, including four extra functions that correspond to their TALES commands: path (string), string (string), exists (string), and nocall (string)

Example:

Checkout!

METAL Macro Language

METAL is a macro language commonly used with TAL & TALES.  METAL allows part of a template to be used as a macro in later parts of a template, or a separate template altogether.

metal:define-macro

Syntax: metal:define-macro="name"

Description:  Defines a new macro that can be reference later as "name".

Example: 

Copyright 2004

metal:use-macro

Syntax: metal:use-macro="expression"

Description:  Evaluates "expression" and uses this as a macro.

Example: 

metal:define-slot

Syntax: metal:define-slot="name"

Description:  Defines a customisation point in a macro with the given name.

Example:

Standard disclaimer for the site.

Contact admin@site.com

metal:fill-slot

Syntax: metal:fill-slot="name"

Description:  Replaces the content of a slot with this element.

Example:

Contact someone else

problem to eject Apple CD or DVD

Posted by cs on November 28th, 2007

If you have problem to eject Apple CD or DVD, try following:

Most Apple keyboards have an Eject key at the top-right corner of the keyboard.

Press and hold the Eject key until the eject symbol appears onscreen.

You can also eject a disc by restarting your computer and holding down the primary mouse button while the computer is starting up until the disc is ejected.

set linux boot processes with chkconfig

Posted by cs on November 28th, 2007

The  chkconfig command generates and breaks links between the directory /etc/rc.d/init.d/ and the appropriate run level directory: /etc/rc.d/rc[0-6].d/ to control boot process initiation and process shutdown.

chkconfig [--level ]  on | off | reset >
chkconfig --list
chkconfig --list
chkconfig --add

chkconfig --del
chkconfig --level 0123456  off

Examples:

  • chkconfig --level 345 httpd on - forces apache to be invoked for run levels 3, 4 and 5.
  • chkconfig --add httpd - Start the web server daemon upon system boot.
  • chkconfig --del sendmail - Do not start the sendmail daemon upon system boot.
  • chkconfig --list - List all services and init levels.
  • chkconfig --list | grep on - List all services to be started upon system boot.

Using chkconfig to administer xinetd processes.

  • chkconfig wu-ftpd on - Turn on FTP service managed by xinetd.
  • chkconfig ipop3 off - Turn off POP3 service managed by xinetd.

This will reconfigure the appropriate xinetd file (in directory /etc/xinetd.d/) and restart the xinetdprocess.Also see: chkconfig - Linux man page

Install python-mysql ZMySQLDA for zope plone

Posted by cs on November 27th, 2007

After I installed plone for my Suse 10.2, I found the python-mysql, ZMySQLDA are not there.

It turns out the plone 3 and zope 2.10 only supports Python 2.4, thus I download python-mysql rpm for python2.4 at

ftp://rpmfind.net/linux/SuSE-Linux/i386/9.3/suse/i586/python-mysql-1.2.0-3.i586.rpm

$ sudo rpm -ivh python-mysql-1.2.0-3.i586.rpm

The above will install the package to default location /usr/lib .

$rpm -ql python-mysql-1.2.0-3

This will tell you what installed by this rpm. Just copy things to the zope instance folder /opt/python24/lib/python2.4/site-packages/

$sudo cp -r /usr/local/lib/python2.4/site-packages/MySQLdb /opt/python24/lib/python2.4/site-packages/

$sudo cp /usr/local/lib/python2.4/site-packages/_mysql.so /opt/python24/lib/python2.4/site-packages/

$sudo cp /usr/local/lib/python2.4/site-packages/_mysql_exceptions.py /opt/python24/lib/python2.4/site-packages/

$sudo cp /usr/local/lib/python2.4/site-packages/_mysql_exceptions.pyc /opt/python24/lib/python2.4/site-packages/

Try to import _mysql in python

$python2.4

>>>import _mysql

It should give you no error.

$tar -xzvf ZMySQLDA-2.0.8.tar.gz

Files will be untared to ./lib/python/Products/ZMySQLDA/

$sudo cp -r ./lib/python/Products/ZMySQLDA /var/opt/zope/default/Products Restart zope: sudo rczope restart

You should be able to see ZMySQLDA in Zope now.

set up a project in subversion

Posted by cs on October 11th, 2007

Assume the subversion has already been installed on your system.

1. Create Subversion Home folder

#mkdir -p /home/svn

2. Create a generic repository format

#mkdir -p /home/svn/default/trunk # mkdir /home/svn/default/branches # mkdir /home/svn/default/tags

3. Setup Blanket Access: If you wish to enable htaccess style password login to the subversion repository then use this system. This is the basic access control system, which can be extended to enable per directory access control as well.

#mkdir /home/svn/access

#touch /home/svn/access/users

#htpasswd -mb /home/svn/access/users myname mypw

4 . Extending the Blanket Access control to enable Per-Directory Access control

# touch /home/svn/access/control

example content of control file:

[/] admin = rw manager = r

[/bigproject] manager = rw commiter = r

[/bigproject/trunk] commiter = rw client = r

[/bigproject/branches] client = r

[/bigproject/trunk/manager_notes] client = commiter =

5. Build a project repository #mkdir /home/svn/repos

# svnadmin create /home/svn/repos/myproject

#svn import /home/svn/default file:///home/svn/repos/myproject -m "Initial Import"

6. check out the project to workspace

cd ~/myworkspace

svn checkout file:// home/svn/repos/myproject/trunk myproject

7. add files to myproject and do commit

svn commit -m "import initial code "

svn update