Tuesday, December 14, 2010

Mean Machines - Future of Silent warfare - Undersea combat vehicles

The term "Silent Service" evokes images of Second World War submarines complete with foul air, battery acid and diesel fuel.


In conventionally powered diesel-electric subs, the diesel engines powered the motors on the surface and charged her batteries. The batteries powered her motors submerged, the same principles used since before World War I

The present day nuclear powered fleet ballistic missile submarine brings a new meaning to the term "Silent Service." With its slippery Black painted stealthy hull and ultra quiet machinery — its silence can be very deadly to any aggressor

“Underway on nuclear power.” The USS Nautilus (SSN-571) signaled that historic message at 11:00 hours on 17 January 1955 as she put to sea for the first time as the first nuclear powered submarine of the world. She went on to make headlines by surfacing at the North Pole and traveling submerged far longer than the diesel-electric submarines of her time. Her power plant gave the US a leap ahead in submarine development towards the modern nuclear submarine of today!

There are two forces that impede a submarine’s speed underwater; skin friction and eddy-making resistance. To overcome skin friction the nuclear sub's hull is made as small in area and as smooth as possible. Overcoming the eddy-making resistance requires the streamlining or removal of protuberances from the hull. Fins and control surfaces are streamlined. The nuclear subs of today have minimal or no flat deck. Their conning towers are reduced to the sail configuration that are common on all of today’s fast attack submarines. The circular hull section offers the greatest resistance to the pressure found in the ocean’s great depths, as well as minimizes eddies. This is important because the propeller wash and eddies can leave a tell tale signature or wake for ships above.

Today's Nuclear powered submarines are silent, powerful, radar and sonar evading, and can fire guided-missiles to pulverize an enemy more than 1,600km away. Any country possessing one has an awesome retaliatory capability. Its the principle of "I can hit back anytime, anywhere, and you cannot do a damn thing about it" philosophy which make subs such mean machines

These super-subs have huge nuclear reactors that can power a small city and it will never need refueling.





The killer nuclear submarine, which is more complex than the US space shuttles and able to circumnavigate the globe without surfacing, is also able to make oxygen and fresh water from seawater to keep her crew alive when undersea for a long time in time of war



For scale, some of these smaller subs weigh 7,400 tons, are more than 291 foot long, the length of a football pitch, as wide as four double-Decker buses and 12 storeys high.










In case
most people truly realize what a deadly weapon the submarines are, imagine THIS scenario

A hostile nuclear sub slips silently through the ocean and nears your country's coastline. Stretched as long as two football fields, her silhouette moves like a shadow on the surface. She carries 24 nuclear ballistic missiles. Each missile carries eight nuclear warheads. Each warhead can be sent to a different target. One sub carries the power of 5,000 bombs like the one that destroyed Hiroshima.





Her mission - hide under the sea and stand by for the order to end the world.



An order is issued. The captain receives the order and relays the readying of weapon command down to the weapons officer. The hatch is opened, water floods the missile tube ...............and ..........at the captains orders , the weapons officer turns a firing key…and launch the missile
Could be today , tomorrow........or never................Sure you will see tomorrow ?

Sunday, December 12, 2010

Mean machines - Future Air wars - Air combat vehicles

Air power is an indispensable aspect in any nation's security apparatus. In this concluding part of mean machines, we will look at the manned vehicles which form an indispensable part of the land-sea-air attack vehicles combo




The world's only operational fifth-generation fighter, the F-22 Raptor is, and will remain, unprecedented in its total integration of stealth and advanced avionics

Primary Function: Air dominance, multi-role fighter

Contractor: Lockheed-Martin, Boeing

Power Plant: Two Pratt & Whitney F119-PW-100 turbofan engines with afterburners and two-dimensional thrust vectoring nozzles.

Crew: One

Fuel Capacity: Internal: 18,000 pounds (8,200 kilograms); with 2 external wing fuel tanks: 26,000 pounds (11,900 kilograms)

Speed: Mach 2 class with supercruise capability

Range: More than 1,850 miles ferry range with 2 external wing fuel tanks (1,600 nautical miles)

Ceiling: Above 50,000 feet (15 kilometers)

Armament: One M61A2 20-millimeter cannon with 480 rounds, internal side weapon bays carriage of two AIM-9 infrared (heat seeking) air-to-air missiles and internal main weapon bays carriage of six AIM-120 radar-guided air-to-air missiles (air-to-air loadout) or two 1,000-pound GBU-32 JDAMs and two AIM-120 radar-guided air-to-air missiles (air-to-ground loadout)

Unit Cost: $143 million (about Rs 643 crore)




The Eurofighter is the product of a consortium of British Aerospace, Deutsche Aerospace (Germany), Alenia (Italy), and CASA (Spain), with the United Kingdom and Germany providing technological leadership

Function: Multi-role fighter

Crew: 1

Engines: 2 Eurojet EJ200 afterburning turbofans, 60 kN dry, 93 kN with afterburner

Maximum speed: Mach 2.0+ (2390 km/h at high altitude)

Supercruise speed: Mach 1.3+ at altitude with typical air-to-air armament

Service ceiling: 18,290 m (60,000 ft)

Range: 1390 km

Armament: The Eurofighter carries NATO's best weapons. It has a high load Capacity with flexible missile configurations. It has thirteen carriage points, three of which are capable of holding external fuel tanks. The maximum fuel or weapons payload is 6,500 kg (14,330 lb.).

A mixture of at least 10 ASRAAMs (advanced short range air-to-air missiles) and AMRAAM (advanced medium range air-to-air missiles) can be carried with four of the AMRAAMs housed in low drag, low observability fuselage stations. A wide variety of air-to-surface weapons can be carried on seven stations, including avionics stores such as laser designators.





The F/A-18 Hornet is a supersonic, all-weather carrier-capable multirole fighter jet, designed to dogfight and attack ground targets (F/A for Fighter/Attack).

Contractor: Boeing [McDonnell Douglas Aerospace] and Northrop Grumman (Airframe), General Electric (Engines), and Hughes (Radar)

Power Plant: Two F404-GE-402 afterburning engines, each in the 18,000 pound thrust class, which results in a combat thrust-to-weight ratio greater than 1-to-1. Depending on the mission and loading, combat radius is greater than 500 nautical miles

Mission and Capabilities: The F/A-18 Hornet can perform both air-to-air and air-to-ground missions. Cockpit displays and mission avionics are thoroughly integrated to enhance crew situational awareness and mission capability in high threat, adverse weather/night environments. Cockpits are night vision goggle compatible. Multi-sensor Integration and advanced data link capabilities further enhance situational awareness.

Seating capacity/crew options: Model F/A-18C: one-seat (pilot-only); Model F/A-18D: two-seats (one for the pilot and one for the weapons/sensor officer [WSO])

Top speed: Mach 1.8

Combat radius: 500+ nm (900+ km)

Armament: F/A-18C/D can carry up to 13,700 pounds of external ordnance. Weapon stations include two wingtip stations for Sidewinders, two outboard wing stations for air-to-air or air-to-ground weapons, two inboard wing stations for fuel tanks, air-to-air, or air-to-ground weapons, two nacelle fuselage stations for AMRAAMs, Sparrows, or sensor pods; and one centreline station for fuel or air-to-ground weapons.

Unit cost: $39.5 million (about Rs 180 crore)







The Saab JAS 39 Gripen is a light-weight single engine multirole fighter aircraft manufactured by the Swedish aerospace company Saab. The aircraft is in service with the Swedish Air Force, the Czech Air Force, the Hungarian Air Force and the South African Air Force, and has been ordered by the Royal Thai Air Force.

Role: Fighter/attack/reconaissance

Crew: 1

Wingspan (including Launchers): 8.4m

Ceiling: 50,000ft

Maximum Speed: Supersonic at all altitudes

Engine: The RM12engine, supplied by Volvo Aero, is a development of the GE F404 engine from General Electric. A digital engine control system automatically monitors the engine parameters and automatically switches on the back-up systems if required. A condition monitoring system registers the flight data.

Armament: The Gripen has seven external hardpoints for carrying payloads -- one at each wingtip, two under each wing and one on the fuselage centreline. The Sidewinder, mounted on the wingtips, is an all-aspect attack, short-range missile for enhanced dogfight capability. Air-to-surface missiles include the radar-guided Saab RBS15F anti-ship missile and Raytheon Maverick missile. The internally mounted 27mm Mauser high-energy gun can operate in an automatic radar-guided aiming mode. The stand-off dispenser is the DWF39 from EADS (formerly DaimlerChrysler Aerospace) and Bofors.

Unit cost: $40.61 million (about Rs 182 crore)










The Dassault Rafale is a French twin-engined delta-wing agile multi-role 4.5-generation jet fighter aircraft designed and built by Dassault Aviation

Primary Function: Multi-role fighter / reconnaisance

Crew: Single or twin seater

Powerplant: Two SNECMA M88-3 turbofans each rated at 19,555 lb (86.98 kN) with afterburning

Speed: Maximum level speed 'clean' at 36,090 ft (11000 m) 1,321 mph (1,147 kt / 2125 km/h)

Ceiling: 60,000 ft

Range: 1000 nautical miles

Armament: Cannon: 1 30mm DEFA 554; Mica missile, R 550 Magic 2 missile, BGL 400 (French counterpart to the American Paveway laser guided bombs)

Unit Cost: $82.3 million (about Rs 384 crore)









The Sukhoi Su-30MKI is a variant of the Sukhoi Su-30 jointly-developed by Russia's Sukhoi Corporation and India's Hindustan Aeronautics Limited for the Indian Air Force. It is a heavy class, long-range air superiority fighter which can also act as a multirole, strike fighter aircraft.

Crew: Two seater

Engines: The Su-30MKI is powered by the two AL-31FP turbofans, employing AL-100 vectoring nozzle

Ceiling: 17,500 m (57,415 ft)

Endurance: 10 hours

Max Range: 3,000 km (1,620 nm)

Top Speed: 664 mps (Mach 2)

Armament: Main gun is 30 mm caliber. The combat load is mounted on 12 stations. The maximum advertised combat load is 8000 kg. Over 70 versions of guided and unguided weapon stores, including air-to-air and air-to-surface missiles, may be employed which allows the aircraft to fly the most diverse tactical missions.

Unit Cost: $36.55 million (about Rs 164 crore)








The F-15 Eagle is an all-weather, extremely maneuverable, tactical fighter designed to gain and maintain air superiority in aerial combat.

Primary Function: Tactical fighter

Crew: One (F-15A/C), two (F-15B/D/E)

Powerplant: Two P&W F100 turbofan engines in 29,000 lb (13,154 kg) thrust class with afterburning

Speed: 1,875 mph (Mach 2.5 plus)

Ceiling: 65,000 feet

Range: 3,450 miles ferry range with conformal fuel tanks and three external fuel tanks

Armament: One internally mounted M-61A1 20mm 20-mm, six-barrel cannon with 940 rounds of ammunition; four AIM-9L/M Sidewinder and four AIM-7F/M Sparrow air-to-air missiles, or eight AIM-120 AMRAAMs, carried externally.

Unit Cost: A/B models $27.9 million (about Rs 126 crore), C/D models $29.9 million (about Rs 135 crore)









The F-16 Fighting Falcon is a compact, multi-role fighter aircraft. It is highly maneuverable and has proven itself in air-to-air combat and air-to-surface attack. It provides a relatively low-cost, high-performance weapon system for the United States and allied nations.

Primary Function: Multirole fighter

Crew: One (F-16C) / Two (F-16D)

Powerplant: F-16C/D: one Pratt and Whitney F100-PW-200/220/229 or one General Electric F110-GE-100/129

Speed: 1,500 mph (Mach 2 at altitude)

Ceiling: Above 50,000 feet

Range: Over 2,100 nautical miles

Armament: One M-61A1 20mm multibarrel cannon with 500 rounds; external stations can carry up to six air-to-air missiles, conventional air-to-air and air-to-surface munitions and electronic countermeasure pods

Unit Cost: F-16A/B: $14.6 million (about Rs 65.7 crore), F-16C/D: $18.8 million (about Rs 84.6 crore)









The MiG-29 Fulcrum is Russia's most important tactical fighter. Developed in the 1970s by the Mikoyan design bureau, it entered service with the Soviet Air Force in 1983, and remains in use by the Russian Air Force as well as in many other nations, including India.

Primary Function: Multi-role fighter

Crew: One

Powerplant: Two Klimov/Sarkisov RD-33 turbofans at 18,298 afterburning pounds of thrust each

Speed: Mach 2.3 (1,520 mph)

Ceiling: 55,775 ft (17,000 m)

Range: 932 miles (810 nm/1500 km) with internal fuel

Armament: One 30mm GSh-301 cannon with 150 rounds, Six AAMs, including a mix of SARH and AA-8 Aphid (R60), AA-10 Alamo (R27T), AA-11 Archer, (R73), FAB 500-M62, FAB-1000, TN-100, ECM Pods, S-24, AS-12, AS-14

Unit Cost: $29 million (about Rs 130.5 crore).










The J-10 is a fourth-generation multi-role fighter, produced by the Chengdu Aircraft Industry Co. (CAC). The secretive Chinese programme started in the late 1980s, and is reportedly based on the Israeli Lavi fighter, Israels attempt to develop its own F-16.

Primary Function: Multi-role fighter

Crew: 1

Powerplant: 1x Lyulka-Saturn AL-31FN turbofan, rated at 79.43 kN dry, 122.58 kN with afterburning (17,857 lbf, 27,557 lbf)

Maximum speed: Mach 1.2 at sea level; Mach 2.0 at altitude

Combat radius: 550 km (300 nm, 340 mi)

Maximum range: 1,850 km (1,000 nm, 1,150 mi)

Service ceiling: 18,000 m (59,055 ft)

Armament: Guns: 1 23 mm internal cannon; Hardpoints: 11 -- 3 under each wing and 5 under the fuselage; Missiles: air-to-air (PL-8, PL-11, PL-12, R-73, R-77), air-to-surface (YJ-9, YJ-9K); Bombs: laser-guided and unguided bombs

Unit Cost: 190m yuan ($27.84m or about Rs 125 crore)

Sunday, November 28, 2010

Mean Machines - The future of combat - Cyberdyne System Series 800 may not be so far away

Smart machines are already very much a part of modern warfare. New robots — none of them particularly human-looking — are being designed to handle a broader range of tasks, from picking off snipers to serving as indefatigable night sentries.

On the shopping list for combat forces include
-> A 15-inch robot with a video camera which can scuttles around on spying missions.
-> An almost silent drone aircraft with a four-foot wingspan which can transmit images of buildings below in IR and other modes.
-> A small armored vehicle on tank treads, about the size of a riding lawn mower, equipped with a machine gun and a grenade launcher. These units are known as the Modular Advanced Armed Robotic System, or Maars, and they are made by a company called QinetiQ North America. They can also be used as a nighttime sentry against infiltrators equipped with thermal imaging vision systems, since the battery-powered Maars unit remains invisible — it does not have the heat signature of a human being — and can “shoot” intruders with a laser tag gun without being detected itself.
-> A wagonlike Lockheed Martin device that can carry more than 1,000 pounds of gear and automatically follow a platoon at up to 17 miles per hour
-> For rougher terrain away from roads, engineers at Boston Dynamics are designing a walking robot to carry gear. Scheduled to be completed in 2012, it will carry 400 pounds as far as 20 miles, automatically following a soldier. The four-legged modules have an extraordinary sense of balance, can climb steep grades and even move on icy surfaces.
-> Mobile micro-robots — some no larger than model cars — that, operating in swarms, can map a potentially hostile area, accurately detecting a variety of threats.
-> A robotic submarine system that would intelligently detect underwater mines and protect ships in harbors.


The idea that robots on wheels or legs, with sensors and guns, might someday replace or supplement human soldiers is still a source of extreme controversy.

Proponents for the idea argue that these machines, not only protect soldiers, but also are never distracted, using an unblinking digital eye, or “persistent stare,” that automatically detects even the smallest motion. Nor do they ever panic under fire. One of the great arguments for armed robots is they can fire second. When a robot looks around a battlefield, he said, the remote technician who is seeing through its eyes can take time to assess a scene without firing in haste at an innocent person.

Opponents to this argue instead that civilians will be at greater risk, because of the challenges in distinguishing between fighters and innocent bystanders. Their argument is that that job is maddeningly difficult for human beings on the ground. It only becomes more difficult when a device is remotely operated. Because robots can stage attacks with little immediate risk to the people who operate them, opponents say that robot warriors lower the barriers to warfare, potentially making nations more trigger-happy and leading to a new technological arms race.


One well known automated system is the Predator aircraft, which find their targets with the aid of soldiers on the ground but are operated from the United States.
Because civilians in Iraq and Afghanistan have died as a result of collateral damage or mistaken identities, Predators have generated international opposition and prompted accusations of war crimes.
On the other hand, Predators have also saved thousands of lives which would have been lost on the ground.

Robot combatants are supported by a range of military strategists, officers and weapons designers — and even some human rights advocates. Weapons systems controlled by software will not act out of anger and malice and, in certain cases, can already make better decisions on the battlefield than humans.

Automation has proved vital in the wars America is fighting. In the air in Iraq and Afghanistan, unmanned aircraft with names like Predator, Reaper, Raven and Global Hawk have kept countless soldiers from flying sorties. Moreover, the military now routinely uses more than 6,000 tele-operated robots to search vehicles at checkpoints as well as to disarm one of the enemies’ most effective weapons: the I.E.D., or improvised explosive device.

The International Committee for Robot Arms Control has called for agreements to limit the development and use of tele-operated and autonomous weapons. They have called for standards which all autonomous systems have to adhere to, something similar to the three laws of Asimov
With fifty-six nations now developing robotic weapons of their own, it remain to be seen how the spirit and letter of these standards will be adhered to.

One thing remains for sure, that with this much resources being put in already, there is little chance that proponents , including major governments, will back out of developing such systems. However, the silver lining will be not the use of these systems for combat, but their adaption to civilian use.


Wednesday, July 7, 2010

The credit card 'Da Vinci Code'

A pre-computer security feature was slipped into your credit card numbers and remains there today. Pull out a card and a pencil to see the math trick for yourself.

Did you know your credit card has a "Da Vinci Code"?

It's true. Those raised numerals on your card are not only your account identifier that banks and merchants need to transact business on your behalf, but a little-known credit card version of the Da Vinci Code that verifies its validity without the aid of computers.

Even cooler, the code, which can reveal whether a credit card number is fraudulent, is cryptically hidden within the sequence of the card numbers. Every legitimate credit, debit and ATM card on Earth contains this formula.

This low-tech mathematical sleight of hand, dubbed the Luhn formula after its inventor, Hans Peter Luhn, played a tangential role in the development of the World Wide Web, search engines such as Google, text messaging and other high-tech wonders.

In the unlikely event that you've given any thought at all to your credit card numbers, you probably view them as merely series of random numerals: 16 digits on Visa, MasterCard and Discover cards, 15 on American Express cards and 14 on Diner's Club/Carte Blanche cards.

On a 16-digit card, the first six numerals identify the card issuer, and the next nine numerals are the card account number (AmEx uses an eight-digit account number.)

But there is absolutely nothing random about the final digit of your credit or debit card number. It has been appended as a so-called check number, or key, to verify the card is valid. It's this check number that gives the Luhn formula its Da Vinci Code allure.

When a card number is generated using Luhn's algorithm, various combinations of the digits on the card must ultimately add up to a number that is perfectly divisible by 10. For this reason, Luhn's formula is also referred to as modulus 10, or mod 10 for short. Change any digit or transpose nearly any two digits, and the Luhn check will catch it.

The Luhn formula was designed to instantly detect accidental data entry errors -- missed keystrokes, transpositions and the like -- not as a defense against fraud. It doesn't identify where an invalid number went sideways; it simply flags it as nonconforming.

Luhn checking won't tell you anything about the underlying card account itself. Nor should it be confused with card-verification-value codes, those extra, unembossed numbers on major credit cards that attempt to verify that the physical card is (or has been) in your possession.

Thread counts and keywords

Luhn, who died in 1964, wasn't hunting for the first "killer app" in the credit card world. In fact, when the German-born IBM scientist proposed his formula in 1954, general-purpose credit cards hadn't even been developed. Luhn's formula would later be included as the sum-check for a hand-held mechanical reader, for which he received a patent in 1960.

A former assistant manager of a textile mill, Luhn spent the 1930s and '40s as an engineering consultant to that industry. His Lunometer, a simple rulerlike tool that visually measures the thread and line count in fabrics, is still in use today. Luhn earned more than 80 patents, including a computing gas pump, a cocktail recipe organizer (during Prohibition, no less), an inexpensive foldable raincoat and a forerunner to American Airlines' Sabre reservation management system.

After joining IBM in 1941, Luhn pioneered fundamental concepts in business information retrieval, including keywords in context and selective dissemination of information. Those breakthroughs laid the groundwork for such ubiquitous computer processes as keyword search, e-mail, instant messaging and RSS feeds.

First line against fraud

Although its original intent was to identify human error in the pre-computer days of manual data entry, the Luhn check remains a valuable first line of defense against credit card fraud today.

If the card numbers don't tumble correctly through the algorithm (now computed literally faster than the blink of an eye), the transaction will be halted automatically before it even reaches the card issuer for authorization. Chances are excellent that the next line of anti-fraud software would net any fishy card numbers that slipped through the Luhn check.

For fraud, you have two choices: taking someone else's number or making one up. Luhn didn't know about that type of thing, but his algorithm still helps solve it. If you were ordering something online, it obviously would be nice to give somebody else's number, but that doesn't work.

Why don't you check for yourself

Tuesday, May 25, 2010

Are You an Asker or a Guesser?

We are raised, in one of two cultures. In Ask culture, people grow up believing they can ask for anything—a favour, a pay rise—fully realising the answer may be no. In Guess culture, by contrast, you avoid "putting a request into words unless you're pretty sure the answer will be yes … A key skill is putting out delicate feelers. If you do this with enough subtlety, you won't have to make the request directly; you'll get an offer. Even then, the offer may be genuine or pro forma; it takes yet more skill and delicacy to discern whether you should accept."

Neither's "wrong", but when an Asker meets a Guesser, unpleasantness results. An Asker won't think it's rude to request two weeks in your spare room, but a Guess culture person will hear it as presumptuous and resent the agony involved in saying no. Your boss, asking for a project to be finished early, may be an overdemanding boor—or just an Asker, who's assuming you might decline. If you're a Guesser, you'll hear it as an expectation. This is a spectrum, not a dichotomy, and it explains cross-cultural awkwardnesses, too: Brits and Americans get discombobulated doing business in Japan, because it's a Guess culture, yet experience Russians as rude, because they're diehard Askers.Fascinating stuff; I probably default to guessing, but I aspire to asking. Are you an Asker or a Guesser?

Sunday, March 7, 2010

Using Net-SNMP - 2

This is the second part of the N part series for understanding and working with Netsnmp.

See http://ashokachakra.blogspot.com/2010/03/using-net-snmp-1.html for details

We had configured and set up Netsnmp in the previous post. Now lets go ahead with writing our MIB

Ok, if you now ask me......whats a MIB....then you are in the wrong place. I assume that you already know what SNMP is, and what MIBs are and what an agent and a Manager does. You can refer to Stallings for more gyan....or else wikipedia and the netsnmp wiki ought to give you a basic idea

Our first MIB will have two scalar values, for which we try and get the values. I have borrowed an enterprises number from another blog I found on the net. Thanks for the same.

MY-COMPANY-MIB DEFINITIONS ::= BEGIN

IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, enterprises, Integer32 FROM SNMPv2-SMI;

-- root of our MIB will point to enterprises

myCompanyMIB MODULE-IDENTITY
LAST-UPDATED
"200804230000Z"
ORGANIZATION
"asholachakra.blogspot.com"
CONTACT-INFO
"email: billgates@gmail.com"
DESCRIPTION
"Example MIB"
REVISION
"200804230000Z"
DESCRIPTION
"First and hopefully not the final revision"
::= { enterprises 3011 }

-- lets group all scalarValues in one node of our MIB

scalarValues OBJECT IDENTIFIER ::= { myCompanyMIB 1 }

-- time to define scalar values

hostLoggedUsers OBJECT-TYPE
SYNTAX Integer32 (0..65535)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of actually logged users on"
::= { scalarValues 1 }

hostName OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Actual hostname"
::= { scalarValues 2 }

END


Writing modules for MIBs is a long and sometimes troublesome process, much like writing a parser. And just like writing a parser, you don't have to do everything by hand: MIBs can already be processed by computers pretty well, so there is no need to start from square one every time. The tool to convert an existing MIB to some C code is called mib2c and is part of the Net-SNMP distribution


Ok.....now that you have the MIB
At the command prompt, run mib2c as shown

linux-725y:~/.snmp/mib2cdata # mib2c scalarValues
writing to -
mib2c has multiple configuration files depending on the type of
code you need to write. You must pick one depending on your need.

You requested mib2c to be run on the following part of the MIB tree:
OID: scalarValues
numeric translation: .1.3.6.1.4.1.3011.1
number of scalars within: 2
number of tables within: 0
number of notifications within: 0

First, do you want to generate code that is compatible with the
ucd-snmp 4.X line of code, or code for the newer Net-SNMP 5.X code
base (which provides a much greater choice of APIs to pick from):

1) ucd-snmp style code
2) Net-SNMP style code

Select your choice : 2

**********************************************************************
GENERATING CODE FOR SCALAR OBJECTS:
**********************************************************************

It looks like you have some scalars in the mib you requested, so I
will now generate code for them if you wish. You have two choices
for scalar API styles currently. Pick between them, or choose not
to generate any code for the scalars:

1) If you're writing code for some generic scalars
(by hand use: "mib2c -c mib2c.scalar.conf scalarValues")

2) If you want to magically "tie" integer variables to integer
scalars
(by hand use: "mib2c -c mib2c.int_watch.conf scalarValues")

3) Don't generate any code for the scalars

Select your choice: 1
using the mib2c.scalar.conf configuration file to generate your code.
writing to scalarValues.h
writing to scalarValues.c



**********************************************************************
* NOTE WELL: The code generated by mib2c is only a template. *YOU* *
* must fill in the code before it'll work most of the time. In many *
* cases, spots that MUST be edited within the files are marked with *
* /* XXX */ or /* TODO */ comments. *
**********************************************************************
running indent on scalarValues.c
running indent on scalarValues.h
linux-725y:~/.snmp/mib2cdata #


If you now do an........... ls........... on that directory, you will see two files, scalarvalues.c and scalarvalues.h being generated.

mib2c has generated these two files which are, let's say, the framework to create valid SNMP handler.

We need to improve those files in order to support our SNMP queries: hostName, hostLoggedUsers.

Please note that scalarValues.h does not need any changes, so I only modified scalarValues.c as follows.

#include
#include
#include
#include "scalarValues.h"

struct HostStates
{
int loggedUsers;
char hostname[20];

} hostStates;

void
init_scalarValues(void)
{
static oid hostLoggedUsers_oid[] =
{ 1, 3, 6, 1, 4, 1,3011, 1, 1 };
static oid hostName_oid[] =
{ 1, 3, 6, 1, 4, 1,3011, 1, 2 };

netsnmp_register_scalar(
netsnmp_create_handler_registration("hostLoggedUsers", handle_hostLoggedUsers,
hostLoggedUsers_oid, OID_LENGTH(hostLoggedUsers_oid),
HANDLER_CAN_RONLY
));
netsnmp_register_scalar(
netsnmp_create_handler_registration("hostName", handle_hostName,
hostName_oid, OID_LENGTH(hostName_oid),
HANDLER_CAN_RONLY
));
}
int
handle_hostLoggedUsers(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
// obtain number of logged users here
hostStates.loggedUsers = 4;

switch(reqinfo->mode) {

case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) &hostStates.loggedUsers, sizeof(hostStates.loggedUsers));
break;
default:
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_hostName(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
// obtain hostname here
strcpy(hostStates.hostname, "flechetHost");

switch(reqinfo->mode) {

case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) &hostStates.hostname, strlen(hostStates.hostname));
break;
default:
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;



Ok, so what has changed ?? Mib2c does not know how we want to define the data, it is up to us to use individual data types or a user defined data structure. I have used a user defined data structure to store values for the integer and the octet string, and provided the pointer in memory for the same.

All I am doing at the moment is hardcoding the values of hostLoggedUsers and hostName. Lets get this working first and then see how we can obtain the same dynamically.

After that we will see how to do it for tables (using similar procedure)

Next steps will be to compile the c code into the agent and try to obtain the value.

Now it's time to compile ;) I will compile scalarValues.c to shared library libSnmpHandler.so and than I will install library in /usr/lib directory.

# gcc -shared -fPIC scalarValues.c -o libSnmpHandler.so
#cp libSnmpHandler.so /usr/lib

We can now configure net-snmp daemon to dynamically load our libSnmpHandler.so library on startup. In order to do this we need to create /etc/snmp/snmpd.conf file with following entries.
rocommunity public
rwcommunity public

dlmod scalarValues /usr/lib/libSnmpHandler.so



In snmpd.conf I also added rwcommunity and rocommunity entries. Both are simple passwords used by net-snmp daemon to authenticate SNMP clients. Of course it's possible to protect SNMP in a better way, but it's not area of this article. We're about to finish. Finally we can start net-snmp daemon with command:
# /etc/init.d/snmpd start
* Starting net-snmpd ...

Now it's time to verify if everything is working fine. We can use snmpget and snmpwalk tools to verify our work.
# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.3011.1
MY-COMPANY-MIB::hostLoggedUsers.0 = INTEGER: 4
MY-COMPANY-MIB::hostName.0 = STRING: "
flechetHost"

# snmpwalk -v 2c -c public localhost scalarValues
MY-COMPANY-MIB::hostLoggedUsers.0 = INTEGER: 4
MY-COMPANY-MIB::hostName.0 = STRING: "
flechetHost"

# snmpwalk -v 2c -c public localhost hostLoggedUsers
MY-COMPANY-MIB::hostLoggedUsers.0 = INTEGER: 4

# snmpget -v 2c -c public localhost hostLoggedUsers.0
MY-COMPANY-MIB::hostLoggedUsers.0 = INTEGER: 4



It's working fine! Now it's easy to add another queries to our MIB and libSnmpHandler.so. Possible enhancement are processor temperature, file system state, CPU usage and more and more. With net-snmp we can easily monitor all aspects of Linux box.

Saturday, March 6, 2010

Using Net-SNMP - 1

Hi,

In this N part series, I shall post about

What SNMP is - very, very briefly
Install NetSNMP
Configure NetSNMP
Write a MIB
Use Mib2c to generate stubs for the agent
Populate the Stub code in the agent for the MIB you just wrote
Try and GET snmp to WALK through the NEXT few steps :)

Write more complex MIBs


Ok lets begin then, shall we..........

SNMP (Simple Network Management Protocol) is application layer protocol, mostly used in network devices (i.e. routers, printers, etc). In typical SNMP usage scenario SNMP client sends SNMP Get package to the network device in order to read its properties. When device reports any problems it is also possible to change device configuration using SNMP Set packages. Every device supports various queries (i.e. device uptime) and all of them are described in MIB (Management Information Base).


You can read more about SNMP protocol here: http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol


I told you guys I will be brief :)


Ok ....Now for the Installation ........

First, You will need a Linux System.......because all that I am going to explain next will be for that particular OS

I use Suse Linux 11.2, although I guess RedHat and Gentoo and Debian work just as fine .........

Ok, Login to the linux system ............By the way..............The download is available @ http://net-snmp.sourceforge.net/download.html

You need to pick up the SOURCE of the latest version ......Do not pick up binary, then you cannot play around with the source code. Get the tar.gz , since you will intend to use it on linux (Zip format is for wussies :) )

Ok, so you have the download in your home folder ........ (/home/ folder , where is whatever name you are using to log in.) all ready to be untarred

You will need root privilege to install so issue this command at prompt

$su - root you will be asked for root password , so give that and you are in

Navigate to the home folder where the net snmp tar.gz is kept
Issue this command at the prompt

#tar -zxvf net-snmp-5.5.tar.gz (I happen to be using version 5.5)

It will untar the whole thing and give you a directory like so

# ll
total 5408
drwxr-xr-x 19 274 500 4096 Mar 6 13:57 net-snmp-5.5
-rw-r--r-- 1 root root 5531055 Mar 3 23:21 net-snmp-5.5.tar.gz
#


Navigate into the net-snmp-5.5 directory and you should see something like so




Just have a look at the various README's etc. Or take a break.....or watch TV :) ....Till you are ready to go cracking again.......

The steps you need to do now are
1) Run ./configure
(type "./configure --help" for a quick usage summary.)
(--prefix=PATH will change the default /usr/local installation path.)

2) Optionally edit include/net-snmp/net-snmp-config.h
(due to prompting done by the configure script, this is very rarely
necessary.)

3) make

4) make test (This usually tells you right away whether everything on
the system is good to go or not)

5) make install


Ok......it will take some time....print what its doing all the while..... and then its done

You now have netsnmp installed and ready to use.

Ha Ha .....not quite.......theres still a lot of stuff that needs to be done before we can say .....yup....thats working beautifully.......

Navigate to

1. See if
/usr/local/share/bin folder has a bunch of snmp stuff like snmpconf snmptranslate and so on
2. See if the
/usr/local/share/snmp/mibs folder and see if all the MIB files are present

Now you have to
try some configurations checking

First, give
#net-snmp-config --default-mibdirs


/root/.snmp/mibs:/usr/local/share/snmp/mibs
You should get the reply like so....a list of the directories which are used to pick up snmp MIB data

Now run
linux-725y:/usr/local # net-snmp-config --snmpconfpath

/usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/root/.snmp:/var/net-snmp
You should get the reply like so....a list of the paths which are used to pick up snmp configuration data

Now run

# ldd /usr/local/bin/snmptranslate
linux-gate.so.1 => (0x00110000)
libnetsnmpagent.so.15 => not found
libnetsnmphelpers.so.15 => not found
libnetsnmpmibs.so.15 => not found
libnetsnmp.so.15 => not found

This means that you might get snmp*: error while loading shared libraries:
like for example as mentioned above libnetsnmp.so.20: It cannot open shared object file

If no error comes like above , no need to do anything, but if error comes, then, you have to do the steps below
Edit ld.so.conf in /etc and add the details of the lib path of /usr/local/lib and then run ldconfig
#vi /etc/ld.so.conf

/usr/X11R6/lib/Xaw3d
/usr/X11R6/lib
/usr/lib/Xaw3d
/usr/i386-suse-linux/lib
/usr/local/lib
/opt/kde3/lib
include /etc/ld.so.conf.d/*.conf

#ldconfig

Now you have to tell netsnmp where to look for MIB files. You use the snmpconf command to do this. Issue this command at the prompt
# snmpconf

I can create the following types of configuration files for you.
Select the file type you wish to create:
(you can create more than one as you run this program)

1: snmpd.conf
2: snmptrapd.conf
3: snmp.conf

Other options: quit

Select File: 3

The configuration information which can be put into snmp.conf is divided
into sections. Select a configuration section for snmp.conf
that you wish to create:

1: Debugging output options
2: Textual mib parsing
3: Output style options
4: Default Authentication Options

Other options: finished

Select section: finished

I can create the following types of configuration files for you.
Select the file type you wish to create:
(you can create more than one as you run this program)

1: snmpd.conf
2: snmptrapd.conf
3: snmp.conf

Other options: quit

Select File: quit


The following files were created:

snmp.conf

These files should be moved to /usr/local/share/snmp if you
want them used by everyone on the system. In the future, if you add
the -i option to the command line I'll copy them there automatically for you.

Or, if you want them for your personal use only, copy them to
/root/.snmp . In the future, if you add the -p option to the
command line I'll copy them there automatically for you.

#cp snmp.conf /usr/local/share/snmp/

Finally try this
# snmptranslate -Tp -IR ipMIB
+--ipMIB(48)
|
+--ipMIBConformance(2)
|
+--ipMIBCompliances(1)
| |
| +--ipMIBCompliance(1)
| +--ipMIBCompliance2(2)
|
+--ipMIBGroups(2)
|
+--ipGroup(1)
+--icmpGroup(2)
+--ipv4GeneralGroup(3)
+--ipv4IfGroup(4)
+--ipv6GeneralGroup2(5)
+--ipv6IfGroup(6)
+--ipLastChangeGroup(7)
+--ipSystemStatsGroup(8)
+--ipv4SystemStatsGroup(9)
+--ipSystemStatsHCOctetGroup(10)
+--ipSystemStatsHCPacketGroup(11)
+--ipv4SystemStatsHCPacketGroup(12)
+--ipIfStatsGroup(13)
+--ipv4IfStatsGroup(14)
+--ipIfStatsHCOctetGroup(15)
+--ipIfStatsHCPacketGroup(16)
+--ipv4IfStatsHCPacketGroup(17)
+--ipAddressPrefixGroup(18)
+--ipAddressGroup(19)
+--ipNetToPhysicalGroup(20)
+--ipv6ScopeGroup(21)
+--ipDefaultRouterGroup(22)
+--ipv6RouterAdvertGroup(23)
+--icmpStatsGroup(24)
linux-725y:/usr/local #

This means that everything that you have installed is working

So now the errors are not going to be there because of configuration ......whatever gets screwed up , it will be because of your responsibilty :)

Next part will deal with How to write a MIB and add code from the agent.

Tuesday, February 2, 2010

The science behind Shampoo - and how we end up paying more - Always.

Whats true

There’s no shame in admitting that your hair affects your mood. According to a Dove Hair Care survey, one out of every four women has avoided an activity due to unruly hair and 88 percent say good hair boosts their confidence. So for many women, a trip to the shampoo aisle is a much more serious purchase than stocking up on toothpaste and Q-tips.

A 2008 study from market research firm Mintel reported that half of adults find the variety of shampoos and conditioners overwhelming. When Pantene, the shampoo category leader, offers 113 products in 14 different benefit-themed lines, it’s easy to see how the shelves have become so crowded—and confusing.

The good news? The majority of those options boil down to different packaging. “All shampoo is essentially a cleanser,” says Paula Begoun, author of Beautypedia.com. “Only the first five or six ingredients impact the formula’s effectiveness.” And if you do a quick survey of a few shampoo ingredients labels, you’ll quickly see how the top 10 list looks nearly the same on all of them.

Whats in it .....

But what are those ingredients, and what do they do? We broke down the ingredients on the back of the bottle.

1. Water. Up to 80 percent of shampoo is this basic element. Without enough of it, the lathering liquid wouldn’t pour from the bottle.
2. Surfactant. Basically a detergent, this additive does the bulk of the work. Surfates clean by surrounding dirt and oil so water can rinse them away. Ingredients like ammonium lauryl sulfate and ammonium laureth sulfate tend to be easier on sensitive scalps than sodium lauryl sulfate. Rumors that these chemicals can cause cancer are unfounded. While surfactants are irritating, shampoos don't contain high-enough levels to cause any real damage. Surfactants aren’t a problem unless you have sensitive skin or insist on regularly pouring gallons of the stuff in your eyes. And the cleansers shouldn’t be harmful to your hair. The shampoos sold today contain conditioners that compensate for the stripping qualities of surfactants, so you can wash daily without worry.
3. Foaming agents. Ingredients like cocamide or cocamidopropyl betaine provide the satisfying suds that complete the hair-washing experience. Lather, however, is purely aesthetic. “Lather doesn’t have anything to do with how well a shampoo works,” says Ni’Kita Wilson, a cosmetics chemist for Cosmetech Laboratories. “Manufacturers put lathering agents in shampoos because it’s what consumers expect.”
4. An acidic ingredient. Items like sodium citrate or citric acid on your shampoo label are added to keep shampoo at the right pH level. The acidic pH interacts with the hair's slightly negative charge to help the cuticle, the outer layer of the hair, maintain a smooth, flat surface.
5. Silicones like dimethicone, or anything ending in 'one.' These are polymers that deposit a lightweight coating on the hair. They help create smoothness and add shine.
6. Polyquaternium. Much like a fabric softener, it helps make hair more manageable by depositing a fatty conditioner and fighting static. It also thickens the shampoo formula so it’s easier to pour.
7. Panthenol, fatty alcohols, and nut oils. These common additives moisturize and lock in hydration.
8. Midazolidinyl urea, iodopropynyl, isothiazolinone, and sodium benzoate. “Unless you want your shampoo to grow legs and walk away, you need preservatives,” Wilson says. Since many of the other ingredients are made from organic materials, they can grow mold and bacteria. These additives keep your shampoo from turning into a science project.

“Most often, the ingredients lower down on the list aren’t present in high-enough concentrations to have any impact on the shampoo’s performance,” Begoun says. Natural extracts and other additives that manufacturers brag about on the label don’t do much for your hair, but they might make the experience more enjoyable by adding a little color or fragrance to the process. Of course, judging by the number of women (and men) sniffing shampoo in the personal-care aisle of the drugstore, fragrance is a big part of the shampoo equation. To wit: the phenomenon that was Gee, Your Hair Smells Terrific.


The catch

So if all of these ingredients are basically the same, why are some shampoos more expensive? Good question. Price rarely is an indicator of performance. “There’s no reason at all to pay more than $7 for a bottle of shampoo,” Begoun says. In fact, when Consumer Reports tested 1,700 ponytail samples by washing them in a range of shampoos, the expensive options did not produce any better results than the drugstore brands. You won’t see 10 times more results with a $30 bottle over a $3 bottle. “The only way to find out if a shampoo will work for you is by using it,” Wilson says. “Nothing on the bottle, including the price tag, can tell you if you’re really going to like the results.” If you rely on a high-priced brand to ensure a good hair day, you could be sending money down the drain.

Instead of shopping by price, Begoun suggests this strategy to help find the best formula for your hair: your shampoo, she says, should treat your scalp and your conditioner should treat the bottom few inches of your hair. So if you have an oily scalp and split ends, a shampoo formulated for oily hair will remove grease, and a repairing conditioner will help protect the ends.

If that fails? Well, there's always a headband.

Wednesday, January 27, 2010

The restaurant at the end of the Universe

Came across a wonderful blog explaining the advances we had made - which is now lost in the mists of time - and by the burning down of our heritage - Nalanda and Somnath and all other places which fell under he sword and flame of the heathen barbarians.

This is the link

http://slezall.blogspot.com/

I would recommend everyone have a look, lots and lots of good stuff here

Here i reproduce verbatim one blog, just to show the extent of advancement we had

Value of Pye in Atharva Veda


Value of Pye in Athrava Veda

The transliteration would be as follows -


GoPeeBHaagYa MaDHuvRaaTa SHrunGiSHoDaDHiSanDHiGa
KHaLaJeeViTaKHaaTaaVa GaLaHaaLaaRaSanDHaRa

I have used capitals for those consonants which have to be deciphered for the values. Some consonants which have the emphatic pronunciation have been spelt along with H.

Tamilians are at a disadvantage. Unfortunately Tamil script has very few consonants. I know that Ka in Tamil is written for as many as four sounds - Ka, KHa, Ga and also GHa. So for writing GanGaa in Tamil, one would write KanKaa. Yet Tamil has two "na"s and two "LLa"s. They say that the second "LLa" is difficult to explain to a non-Tamilian.


Devanagaree script has better distinction. Kannada is even more detailed on the vowels, since it also distinguishes "ey" both as short and long, i.e. "ey" in "get" is written differently than "ey" in "Gate". Likewise there are short and long "oe"s in Kannada, to spell "notice" and "goat" differently.

Coming back to value of Pye, Values of identified consonants are to be put in by the "Sootra"s, which are also embedded in the jpg file. They are -
Kaa-di Nava, i.e. Ka =1, KHa = 2, Ga = 3, GHa = 4, GNa = 5, Cha = 6, ChHa = 7, Ja = 8 and JHa =9
Taa-di Nava, i.e. Ta =1, THa = 2, Da = 3, DHa = 4, NNa = 5, ta = 6, tHa = 7, da = 8 and dHa =9
Paa-di Panchak i.e. Pa =1, PHa = 2, Ba = 3, BHa = 4, Ma = 5
Yaa-dyashtaka i.e. Ya =1, Ra = 2, La = 3, Wa = 4, sha = 5, SHa = 6, Sa = 7, Ha = 8
Ksha-sh Shoonyam i.e. Ksha = 0

So, the sootras provide 4 options each for 1, 2, 3, 4 and 5, three options each for 6, 7, 8, two options for 9 and only one option for zero. Options help to put values into verse form. In Americapeople get telephone numbers which can be spelled to denote the activity of the company. For example, the company publishing a magazine “SkyMall” has its number 1-800-759-6255. When spelled, it becomes 1-800-SkyMall, because number 7 on telephones stands for letter S, number 5 for K and so on.

In this shloka for value of Pye, the first line is also an ode to Lord Krishna, as is clear from the mention of Gopi-Bhagya. The second line is ode to Lord Shiva, as can be read from "Gala-Haalaarasam-Dhara", one who wears a serpent around his neck. So, the shloka is both, prayers and value of Pye!!!

From the scientific mode of calculator available on computers the value is

3.1 41 59 26 53 58 97 93 23 84 62 64 33 83 27 95

Value from Shloka as deciphered is -

Go Pee BHaag Ya Ma DHuv Raa Ta SHrun Gi SHo Da DHi San DHi Ga
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3
KHa La Jee Vi Ta KHaa Taa Va Ga La Haa Laa Ra San DHa Ra
2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 2

In the shloka, the last digit denoted by the letter Ra becomes 2. In the calculator it is 5. All the rest 31 digits are identical.

The point of curiosity is, why did Rushees of Athrva-Veda need such accurate value of Pye to the thirty-second digit? Simple explanation is that they have been great astronomers. Most eminent among them was Maharshi Bhrugu, as acknowledged by none other than Lord Krishna in the tenth chapter in Geetaa. "MaharsheeNNaam Bhruguraham"!! He composed Bhrugu-samhitaa, which is the reference work for all uses of astronomy, most common being in Astrology.

Astronomy is study of Universe, Geography is study of only the Earth. And to get exactitude in the study of astronomy, orbits, spatial positions and velocities of different planets with reference to a fixed reference, the Sun, such value of Pye was needed. How such accurate value was derived is another curiosity. But we know that the mathematics of Indian almanacs gives accurate prediction of eclipses, their exact timings - sparsh-kaala, moksha-kaala and geographical boundaries of areas from where an eclipse would be visible, also whether it will be a whole eclipse, Kha-graasa or partial, Khanda-graasa. The base for all this is Bhrugu-Samhitaa, the sage, who had the grasp of the whole Universe, MaharsheeNNaam Bhruguraham!!