UPMC St. Margaret hospital nurse Randy Crim often is mistaken for a volunteer because of his 70-pound companion, a silver Labrador retriever named Linus.

“When I walk into a patient’s room, they think he’s a therapy dog,” Crim said.

Linus plops at Crim’s feet and enjoys the attention, at the same time working hard to prevent Crim — a diabetic — from suffering sugar crashes and surges.

A certified diabetic alert dog, Linus “tells” Crim when his glucose is under 90 or above 140.

“He paws at me or starts to bark if it becomes more serious. He alerts me on a daily basis,” said Crim of West Deer. “He’s more ‘real time’ than my sensor — and he’s right 99% of the time.”

About 37 million people in the U.S., or about 11% of the population, suffer from diabetes, according to the Centers for Disease Control and Prevention. Up to 96 million more have prediabetes.

For people with the illness, it’s an around-the-clock struggle to control blood-sugar levels. A number too low can spur serious health repercussions that include seizures, loss of consciousness or even death.

Medical service dogs can prevent issues from spiking.

Dogs are trained for 1,500 hours, in up to a year’s time, to smell dangerous changes in someone’s blood sugar.

“During training, I had to collect saliva samples on cotton balls when my glucose was in different ranges,” Crim said. “The most common question I get is, ‘What does he smell?’ ”

Medical dogs are skilled in sniffing out the body’s release of volatile organic compounds during hypo- and hyperglycemic episodes.

Linus is hypervigilant for Crim’s distinct smells to help him sustain a healthy blood-sugar range.

“He can be two rooms away, and he’ll run in and paw at me,” Crim said. “Since I’ve had Linus, I haven’t had any crashes. He also keeps me from going too high, which helps prevent vascular damage.”

Crim, 50, has battled diabetes since childhood. About a decade ago, problems started cropping up more persistently, and he was recommended to consider a service dog.

“I was having some lows and crashing pretty quickly,” Crim said. “When someone suggested an alert dog, I didn’t even know they existed.”

Linus, 8, came to the Crim family through Diabetes Alert Dogs of America in Las Vegas, which was founded in the mid-2010s.

According to Assistance Dogs International, there are about 2,000 working service dogs trained each year across all medical needs. There is no official government census tracking the exact numbers.

Waitlists for a diabetic alert dog can span two years.

The cost is about $15,000, which Crim was able to raise through a GoFundMe campaign. He said service dogs are not covered by insurance.

“We’ve been coming to work together every day for seven years,” said Crim, who has been with UPMC for about 11 years.

He also is an associate professor at Community College of Allegheny County.

Crim jokingly said he’s not a great advocate for the service dog community — the general rule of which is not to let people pet your animal.

“Unfortunately, working in the hospital, this was challenging from day one,” he said.

The first day on the job for Linus, Crim was taking care of a burn patient who had lost everything they owned in a structure fire, including their pets.

“As I entered the room, the patient told me the story and asked if they could pet Linus,” Crim said. “Obviously, I could not say no. From then on, Linus learned if he gets pets, I give him treats. He’s always looking to get both.”

Crim said Linus has improved not only his health but the ability to do his job. A bonus is the majority of his patients love the dog.

“They forget why they pressed their call light,” Crim said. “They all want to talk about Linus.”