Wednesday, May 11, 2011

Old jokes (Today Microsoft bought Skype)

 Today Microsoft bought Skype, this is a good occasion to remember what people say.

MICROSOFT JOKES

MICROSOFT JOKES



Tech Support: "Do you have any windows open right now?"
Customer: "Are you crazy woman, it's twenty below outside ..."

--------------------------------------------------------------------------------
They say when you play that Microsoft CD backward you can hear satanic messages ... but that's nothing. If you play it forward it will install Windows.

--------------------------------------------------------------------------------
No, Windows is not a virus. Here's what viruses do:
1. They replicate quickly. ... Okay, Windows does that.
2. Viruses use up valuable system resources, slowing down the system as they do so. ... Okay, Windows does that.
3. Viruses will, from time to time, trash your hard disk. ... Okay, Windows does that too.
4. Viruses are usually carried, unknown to the user, along with valuable programs and systems. ... Sigh.. Windows does that, too.
5. Viruses will occasionally make the user suspect their system is too slow (see 2) and the user will buy new hardware. ... Yup, Windows does that, too.
Until now it seems Windows is a virus but there are fundamental differences: Viruses are well supported by their authors, are running on most systems, their program code is fast, compact and efficient and they tend to become more sophisticated as they mature.
So Windows is not a virus. ... It's a bug.

--------------------------------------------------------------------------------
Customer: "How much do Windows cost?"
Tech Support: "Windows costs about $100."
Customer: "Oh, that's kind of expensive. Can I buy just one window?"

--------------------------------------------------------------------------------
At a recent computer expo (COMDEX), Bill Gates reportedly compared the computer industry with the auto industry and stated:
"If GM had kept up with technology like the computer industry has, we would all be driving twenty-five dollar cars that got 1,000 miles to the gallon."
In response to Bill's comments, General Motors issued a press release stating (by Mr. Welch himself):
"If GM had developed technology like Microsoft, we would all be driving cars with the following characteristics:
1) For no reason whatsoever your car would crash twice a day.
2) Every time they painted new lines on the road you would have to buy a new car.
3) Occasionally your car would die on the freeway for no reason, and you would just accept this, restart and drive on.
4) Occasionally, executing a manoeuvre such as a left turn, would cause your car to shut down and refuse to restart, in which case you would have to reinstall the engine.
5) Only one person at a time could use the car, unless you bought "Car95" or "CarNT". But then you would have to buy more seats.
6) Macintosh would make a car that was powered by the sun, reliable, five times as fast, and twice as easy to drive, but would only run on five percent of the roads.
7) The oil, water temperature and alternator warning lights would be replaced by a single "general car default" warning light.
8) New seats would force everyone to have the same size butt.
9) The airbag system would say "Are you sure?" before going off.
10) Occasionally for no reason whatsoever, your car would lock you out and refuse to let you in until you simultaneously lifted the door handle, turned the key, and grab hold of the radio antenna.
11) GM would also require all car buyers to also purchase a deluxe set of Rand McNally road maps (now a GM subsidiary), even though they neither need them nor want them. Attempting to delete this option would immediately cause the car's performance to diminish by 50% or more. Moreover, GM would become a target for investigation by the Justice Department.
12) Every time GM introduced a new model car buyers would have to learn how to drive all over again because none of the controls would operate in the same manner as the old car.
13) You'd press the "start" button to shut off the engine.

--------------------------------------------------------------------------------
This is Linux land. In silent nights you can hear the Windows machines rebooting.

--------------------------------------------------------------------------------
If Windows is the solution, can we please have the problem back?

--------------------------------------------------------------------------------
Computers are like air conditioners, they stop working properly if you open Windows.

--------------------------------------------------------------------------------
Macs are for those who don't want to know why their computer works.
Linux is for those who want to know why their computer works.
DOS is for those who want to know why their computer doesn't work.
Windows is for those who don't want to know why their computer doesn't work.

--------------------------------------------------------------------------------

If Windows is the solution, can we please have the problem back?
 
--------------------------------------------------------------------------------
There was once a young man who, in his youth, professed his desire to become a great writer.
When asked to define "great" he said, "I want to write stuff that the whole world will read, stuff that people will react to on a truly emotional level, stuff that will make them scream, cry, howl in pain and anger!"
He now works for Microsoft, writing error messages.

--------------------------------------------------------------------------------
They say when you play that Microsoft CD backward you can hear satanic messages ... but that's nothing. If you play it forward it will install Windows.

--------------------------------------------------------------------------------
In Computer Heaven:
The management is from Intel,
The design and construction is done by Apple,
The marketing is done by Microsoft,
IBM provides the support,
Gateway determines the pricing.

In Computer Hell:
The management is from Apple,
Microsoft does design and construction,
IBM handles the marketing,
The support is from Gateway,
Intel sets the price.

--------------------------------------------------------------------------------
A pilot is flying a small, single-engine, charter plane with a couple of really important executives on board into Seattle airport. There is fog so thick that visibility is 40 feet, and his instruments are out. He circles looking for a landmark and after an hour, he is low on fuel and his passengers are very nervous. At last, through a small opening in the fog he sees a tall building with one guy working alone on the fifth floor. Circling, the pilot banks and shouts through his open window: "Hey, where am I?". The solitary office worker replies: "You're in an airplane.". The pilot immediately executes a swift 275 degree turn and executes a perfect blind landing on the airport's runway five miles away. Just as the plane stops, the engines cough and die from lack of fuel. The stunned passengers ask the pilot how he did it. "Elementary," replies the pilot, "I asked the guy in that building a simple question. The answer he gave me was 100% correct but absolutely useless; therefore, I knew that must be Microsoft's support office and from there the airport is three minutes away on a course of 87 degrees."

--------------------------------------------------------------------------------
The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners.
 
--------------------------------------------------------------------------------
At a recent computer expo (COMDEX), Bill Gates reportedly compared the computer industry with the auto industry and stated:
"If GM had kept up with technology like the computer industry has, we would all be driving twenty-five dollar cars that got 1,000 miles to the gallon."
In response to Bill's comments, General Motors issued a press release stating (by Mr. Welch himself):
"If GM had developed technology like Microsoft, we would all be driving cars with the following characteristics:
1) For no reason whatsoever your car would crash twice a day.
2) Every time they painted new lines on the road you would have to buy a new car.
3) Occasionally your car would die on the freeway for no reason, and you would just accept this, restart and drive on.
4) Occasionally, executing a manoeuvre such as a left turn, would cause your car to shut down and refuse to restart, in which case you would have to reinstall the engine.
5) Only one person at a time could use the car, unless you bought "Car95" or "CarNT". But then you would have to buy more seats.
6) Macintosh would make a car that was powered by the sun, reliable, five times as fast, and twice as easy to drive, but would only run on five percent of the roads.
7) The oil, water temperature and alternator warning lights would be replaced by a single "general car default" warning light.
8) New seats would force everyone to have the same size butt.
9) The airbag system would say "Are you sure?" before going off.
10) Occasionally for no reason whatsoever, your car would lock you out and refuse to let you in until you simultaneously lifted the door handle, turned the key, and grab hold of the radio antenna.
11) GM would also require all car buyers to also purchase a deluxe set of Rand McNally road maps (now a GM subsidiary), even though they neither need them nor want them. Attempting to delete this option would immediately cause the car's performance to diminish by 50% or more. Moreover, GM would become a target for investigation by the Justice Department.
12) Every time GM introduced a new model car buyers would have to learn how to drive all over again because none of the controls would operate in the same manner as the old car.
13) You'd press the "start" button to shut off the engine. 

Wednesday, May 4, 2011

MySQL monitoring with OpenNMS 1.8.11 and JDBC

 There are different ways to monitor MySQL using OpenNMS: mysql snmp project, with php script and agregation with OpenNMS http collector and using JDBC facility in OpenNMS. Some people say that using MySQL SNMP is more beneficial in sense of traffic usage and reporting results. JDBC is good if you don't have access on remote host to compile mysql snmp (or don't want to make rpm,deb and port:) and just want to ask DBA to add user for monitoring.
 This is a compilation of the wiki articles, which you can found here and here.

 Although OpenNMS wiki describes Capsd settings, we will ignore this and use it's replacemen, that is provisiond+detectors.


 a) OpenNMS dataflow assumes that first every service have to be detected with simple check. Detector configured in WebUI: Admin->Provisioning Groups->Edit Foreign Source->Add detector->JDBC

Here I put foreign source xml file, so that you can pick up necessary parameters:

<detector class="org.opennms.netmgt.provision.detector.jdbc.JdbcDetector" name="JDBC for MySQL">
            <parameter value="opennms" key="user"/>
            <parameter value="abc" key="password"/>
            <parameter value="com.mysql.jdbc.Driver" key="dbDriver"/>
            <parameter value="jdbc:mysql://xx.xx.xx.xx/information_schema" key="url"/>
            <parameter value="3" key="retries"/>
            <parameter value="3306" key="port"/>
</detector>




Database URL is constructed according to this.

OpenNMS needs addition Java components to make DB requests. For that reason I installed libmysql-java (deb) which provided me with
/usr/share/java/mysql-connector-java-5.1.10.jar
 This file should be included in /etc/opennms/opennms.conf like this:
ADDITIONAL_CLASSPATH="/usr/share/java/mysql-connector-java-5.1.10.jar:/usr/share/java/postgresql-jdbc3-8.4.jar"
or just copied into $OPENNMS_HOME/lib/


Otherwise OpenNMS complains about it:

INFO  [scanExecutor-9] NullDetectorMonitor: JDBC for MySQL: An undeclared throwable exception was caught contating address xx.xx.xx.xx port 3306
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver




b) After detection data may be collected via collectd. That is why we add following to the collectd-configuration.xml (xx.xx.xx.xx - may be a host name or an ip)


<package name="mysql">
    <filter>IPADDR != '0.0.0.0'</filter>
    <specific xmlns="">xx.xx.xx.xx</specific>
        <service name="MySQL" interval="300000" user-defined="false" status="on">
       <parameter key="retry" value="2"/>
       <parameter key="timeout" value="3000"/>
       <parameter key="collection" value="mysql"/>
       <parameter key="url" value="jdbc:mysql://xx.xx.xx.xx/information_schema"/>
       <parameter key="user" value="opennms"/>
       <parameter key="password" value="abc"/>
       <parameter key="driver" value="com.mysql.jdbc.Driver"/>
     </service>
 </package>



Collection service from first part should be linked with actual Java collector. Put this also in collectd-configuration.xml


<collector service="MySQL" class-name="org.opennms.netmgt.collectd.JdbcCollector"/>




c) Collection "mysql" from the above should be linked with corresponding datacollection description (snmp, http, jdbc etc). Thus place this into  jdbc-datacollection-config.xml (If my formating sux just copy from original wiki)


<jdbc-collection name="mysql">
        <rrd step="300">         
                  <rra>RRA:AVERAGE:0.5:1:2016</rra>
                  <rra>RRA:AVERAGE:0.5:12:1488</rra>
                  <rra>RRA:AVERAGE:0.5:288:366</rra>
                  <rra>RRA:MAX:0.5:288:366</rra>   
                  <rra>RRA:MIN:0.5:288:366</rra>   
        </rrd>                                     
      <queries>                                    
        <query name="Uptime" ifType="all" >        
          <statement>                              
            <queryString>show global status like 'Uptime'</queryString>
          </statement>                                                
          <columns>                                                   
           <column name="MyUptime" data-source-name="Value" alias="MyUptime" type="GAUGE"/>
          </columns>                                                                     
        </query>                                                                         
        <query name="Bytes_received" ifType="all" >                                      
          <statement>                                                                    
            <queryString>show global status like 'Bytes_received'</queryString>          
          </statement>                                                                   
          <columns>                                                                      
           <column name="MyBytesReceived" data-source-name="Value" alias="MyBytesReceived" type="COUNTER"/>
          </columns>                                                                                      
        </query>                                                                                          
        <query name="Bytes_sent" ifType="all" >                                                           
          <statement>                                                                                     
            <queryString>show global status like 'Bytes_sent'</queryString>                               
          </statement>                                                                                    
          <columns>                                                                                       
           <column name="MyBytesSent" data-source-name="Value" alias="MyBytesSent" type="COUNTER"/>        
          </columns>                                                                                      
        </query>                                                                                          
        <query name="Com_delete" ifType="all" >                                                           
          <statement>                                                                                     
            <queryString>show global status like 'Com_delete'</queryString>                               
          </statement>                                                                                    
          <columns>                                                                                       
           <column name="MyComDelete" data-source-name="Value" alias="MyComDelete" type="COUNTER"/>        
          </columns>                                                                                      
        </query>                                                                                          
        <query name="Com_delete_multi" ifType="all" >                                                     
          <statement>                                                                                     
            <queryString>show global status like 'Com_delete_multi'</queryString>                         
          </statement>                                                                                    
          <columns>                                                                                       
           <column name="MyComDeleteMulti" data-source-name="Value" alias="MyComDeleteMulti" type="COUNTER"/>
          </columns>                                                                                         
        </query>                                                                                             
        <query name="Com_insert" ifType="all" >                                                              
          <statement>                                                                                        
            <queryString>show global status like 'Com_insert'</queryString>                                  
          </statement>                                                                                       
          <columns>                                                                                          
           <column name="MyComInsert" data-source-name="Value" alias="MyComInsert" type="COUNTER"/>           
          </columns>                                                                                         
        </query>                                                                                             
        <query name="Com_insert_select" ifType="all" >                                                       
          <statement>                                                                                        
            <queryString>show global status like 'Com_insert_select'</queryString>                           
          </statement>                                                                                       
          <columns>                                                                                          
           <column name="MyComInsertSelect" data-source-name="Value" alias="MyComInsertSelect" type="COUNTER"/>
          </columns>                                                                                           
        </query>                                                                                               
        <query name="Com_select" ifType="all" >                                                                
          <statement>                                                                                          
            <queryString>show global status like 'Com_select'</queryString>                                    
          </statement>                                                                                         
          <columns>                                                                                            
           <column name="MyComSelect" data-source-name="Value" alias="MyComSelect" type="COUNTER"/>             
          </columns>                                                                                           
        </query>                                                                                               
        <query name="Com_stmt_execute" ifType="all" >                                                          
          <statement>                                                                                          
            <queryString>show global status like 'Com_stmt_execute'</queryString>                              
          </statement>                                                                                         
          <columns>                                                                                            
           <column name="MyComStmtExecute" data-source-name="Value" alias="MyComStmtExecute" type="COUNTER"/>  
          </columns>                                                                                           
        </query>                                                                                               
        <query name="Com_update" ifType="all" >                                                                
          <statement>                                                                                          
            <queryString>show global status like 'Com_update'</queryString>                                    
          </statement>                                                                                         
          <columns>                                                                                            
           <column name="MyComUpdate" data-source-name="Value" alias="MyComUpdate" type="COUNTER"/>             
          </columns>                                                                                           
        </query>                                                                                               
        <query name="Com_update_multi" ifType="all" >                                                          
          <statement>                                                                                          
            <queryString>show global status like 'Com_update_multi'</queryString>                              
          </statement>                                                                                         
          <columns>                                                                                            
           <column name="MyComUpdateMulti" data-source-name="Value" alias="MyComUpdateMulti" type="COUNTER"/>  
          </columns>                                                                                           
        </query>                                                                                               
        <query name="Created_tmp_disk_tables" ifType="all" >                                                   
          <statement>                                                                                          
            <queryString>show global status like 'Created_tmp_disk_tables'</queryString>                       
          </statement>                                                                                         
          <columns>                                                                                            
           <column name="MyCreatTmpDiskTbl" data-source-name="Value" alias="MyCreatTmpDiskTbl" type="COUNTER"/>
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Created_tmp_tables" ifType="all" >                                                              
          <statement>                                                                                                
            <queryString>show global status like 'Created_tmp_tables'</queryString>                                  
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyCreatTmpTables" data-source-name="Value" alias="MyCreatTmpTables" type="COUNTER"/>      
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="key_buffer_size" ifType="all" >                                                                 
          <statement>                                                                                                
            <queryString>show global variables like 'key_buffer_size'</queryString>                                  
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyKeyBufferSize" data-source-name="Value" alias="MyKeyBufferSize" type="GAUGE"/>            
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="key_cache_block_size" ifType="all" >                                                            
          <statement>                                                                                                
            <queryString>show global variables like 'key_cache_block_size'</queryString>                             
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyKeyCacheBlkSize" data-source-name="Value" alias="MyKeyCacheBlkSize" type="GAUGE"/>     
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Key_blocks_unused" ifType="all" >                                                               
          <statement>                                                                                                
            <queryString>show global status like 'Key_blocks_unused'</queryString>                                   
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyKeyBlkUnused" data-source-name="Value" alias="MyKeyBlkUnused" type="GAUGE"/>           
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Key_read_requests" ifType="all" >                                                               
          <statement>                                                                                                
            <queryString>show global status like 'Key_read_requests'</queryString>                                   
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyKeyReadReqs" data-source-name="Value" alias="MyKeyReadReqs" type="COUNTER"/>          
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Key_reads" ifType="all" >                                                                       
          <statement>                                                                                                
            <queryString>show global status like 'Key_reads'</queryString>                                           
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyKeyReads" data-source-name="Value" alias="MyKeyReads" type="COUNTER"/>                     
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Key_write_requests" ifType="all" >                                                              
          <statement>                                                                                                
            <queryString>show global status like 'Key_write_requests'</queryString>                                  
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="Value" data-source-name="Value" alias="MyKeyWriteReqs" type="COUNTER"/>        
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Key_writes" ifType="all" >                                                                      
          <statement>                                                                                                
            <queryString>show global status like 'Key_writes'</queryString>                                          
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyKeyWrites" data-source-name="Value" alias="MyKeyWrites" type="COUNTER"/>                   
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Open_files" ifType="all" >                                                                      
          <statement>                                                                                                
            <queryString>show global status like 'Open_files'</queryString>                                          
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyOpenFiles" data-source-name="Value" alias="MyOpenFiles" type="GAUGE"/>                     
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Open_tables" ifType="all" >                                                                     
          <statement>                                                                                                
            <queryString>show global status like 'Open_tables'</queryString>                                         
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyOpenTables" data-source-name="Value" alias="MyOpenTables" type="GAUGE"/>                   
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="table_cache" ifType="all" >                                                                     
          <statement>                                                                                                
            <queryString>show global variables like 'table_cache'</queryString>                                      
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyTableCache" data-source-name="Value" alias="MyTableCache" type="GAUGE"/>                   
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Questions" ifType="all" >                                                                       
          <statement>                                                                                                
            <queryString>show global status like 'Questions'</queryString>                                           
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyQuestions" data-source-name="Value" alias="MyQuestions" type="COUNTER"/>                    
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Slow_queries" ifType="all" >                                                                    
          <statement>                                                                                                
            <queryString>show global status like 'Slow_queries'</queryString>                                        
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MySlowQueries" data-source-name="Value" alias="MySlowQueries" type="COUNTER"/>               
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Connections" ifType="all" >                                                                     
          <statement>                                                                                                
            <queryString>show global status like 'Connections'</queryString>                                         
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyConnections" data-source-name="Value" alias="MyConnections" type="COUNTER"/>                
          </columns>                                                                                                 
        </query>                                                                                                     
        <query name="Threads_created" ifType="all" >                                                                 
          <statement>                                                                                                
            <queryString>show global status like 'Threads_created'</queryString>                                     
          </statement>                                                                                               
          <columns>                                                                                                  
           <column name="MyThreadsCreatd" data-source-name="Value" alias="MyThreadsCreatd" type="COUNTER"/>          
          </columns>                                                                                                 
        </query>
        <query name="Threads_cached" ifType="all" >
          <statement>
            <queryString>show global status like 'Threads_cached'</queryString>
          </statement>
          <columns>
           <column name="MyThreadsCachd" data-source-name="Value" alias="MyThreadsCachd" type="GAUGE"/>
          </columns>
        </query>
        <query name="Threads_connected" ifType="all" >
          <statement>
            <queryString>show global status like 'Threads_connected'</queryString>
          </statement>
          <columns>
           <column name="MyThreadsCnnctd" data-source-name="Value" alias="MyThreadsCnnctd" type="GAUGE"/>
          </columns>
        </query>
        <query name="Threads_running" ifType="all" >
          <statement>
            <queryString>show global status like 'Threads_running'</queryString>
          </statement>
          <columns>
           <column name="MyThreadsRunng" data-source-name="Value" alias="MyThreadsRunng" type="GAUGE"/>
          </columns>
        </query>
      </queries>

    </jdbc-collection>



d) In snmp-graph.properties (don't know why snmp) the graph description should be added. Exactly like in the official howto:


http://www.opennms.org/wiki/JDBC_Collection_configuration_for_MySQL


e) MySQL user created just to allow OpenNMS to connect and perform request on information schema.


In case you locked the user, allow access to MySQL again on the database host by:

mysqladmin flush-hosts