Checking exactness of a triangle on stalks Suppose I have a triangle
$$A \to B \to C \to A[1]$$
in $D(Ab(X))$, the derived category of abelian sheaves on some topological space $X$. For each $x \in X$, there is an exact functor $D(Ab(X)) \to D(Ab)$ that takes a complex of sheaves to the complex of stalks at $x$.
Is my triangle an exact triangle if the image under the stalk functor is exact for all $x \in X$?
I suspect that the triangle need not be exact.
 A: The answer is no, but we can say a bit more : it can become true if you pass to the derived $\infty$-category and replace the words "distinguished triangle" with "cofiber sequence" (modulo the choice of a nullhomotopy)
I'll assume we already know that the composite $A\to C$ vanishes - this cannot be deduced from a stalkwise assumption, as we will see later.
Complete the morphism $A\to B$ to an exact triangle $A\to B\to \mathrm{cofib}\to A[1]$, then there exists a map of sequences of composable morphisms (not triangles a priori)
$\require{AMScd}\begin{CD}A@>>> B@>>> \mathrm{cofib}\\
@VVV @VVV @VVV \\
A @>>> B @>>> C\end{CD}$
(it's not unique, in fact there will be different ones depending on a chosen nullhomotopy of $A\to C$ in the derived $\infty$-category)
I then claim that $\mathrm{cofib}\to C$ is an equivalence:  because taking stalks is exact, your assumption implies that it is an equivalence stalkwise.
Further note that $H_n(A_x)\cong H_n(A)_x$ naturally in $A$, so that the assumption implies $H_n(A)_x\cong H_n(B)_x$ for all $n$, and so $H_n(A) \cong H_n(B)$ for all $n$, i.e. the map $\mathrm{cofib}\to C$ is an equivalence.
What we have proved is :

Under your assumptions, there exists a morphism $C\to A[1]$ such that the triangle $A\to B\to C\to A[1]$ is distinguished.

However, as is maybe clear from the proof, this morphism $C\to A[1]$ need not be the one you started with, and in particular it is not clear that your original triangle will be distinguished.
Here's a counterexample to that effect:  over $X= Spec(\mathbb Z)$ for instance, find an extension of abelian groups $0\to A\to B\to C\to 0$ which splits when localized at each prime (and thus rationnally), but doesn't split integrally. Then $A\to B\to C\to A[1]$ where we put the $0$ map as the map $C\to A[1]$ is an exact triangle at each stalk, but is not an exact triangle.

The original triangle might not be distinguished.

However, as explained before, there is a map $C\to A[1]$ making it into an exact triangle.
So that's the best we can hope for, and it is true.
(for an explicit counterexample, on can use an extension of $\mathbb Q$ by $\mathbb Z$ given by the following composite morphism $\mathbb{Q\to Q/Z \to Z}/p^\infty \to \mathbb{Q/Z}$ where we use the decomposition of $\mathbb{Q/Z}$ as the sum of its local torsions; where we fix a prime $p$, e.g. $p=2$)
