The management of IoT solutions is a complex task due to their inherent distribution and heterogeneity. IoT management approaches focus on devices and connectivity, thus lacking a comprehensive understanding of the different \textit{software}, \textit{hardware}, and communication components that comprise an IoT-based solution. This work proposes a novel four-layer IoT Management Architecture (IoTManA) that encompasses various aspects of a distributed infrastructure for managing, controlling, and monitoring \textit{software}, \textit{hardware}, and communication components, as well as dataflows and data quality. Our architecture provides a cross-layer graph-based view of the end-to-end path between devices and the cloud. IoTManA has been implemented in a set of \textit{software} components named IoT Management System (IoTManS) and tested in two scenarios - Smart Agriculture and Smart Cities - showing that it can significantly contribute to harnessing the complexity of managing IoT solutions. The cross-layer graph-based modeling of IoTManA facilitates the implemented management System (IoTManS) to detect and identify root causes of typically distributed failures occurring in IoT solutions. We conducted a performance analysis of IoTManS focusing on two aspects - failure detection time and scalability - to demonstrate application scenarios and capabilities. The results show that IoTManS can detect and identify the root cause of failures in 806ms to 90,036ms depending on its operation mode, adapting to different IoT needs. In addition to validating the feasibility of implementing the architecture, the experiments also demonstrate that the scalability of IoTManS is directly proportional to the scalability of the underlying IoT platform, managing up to 5,000 components simultaneously. We also conducted a discussion about the features that can still be implemented in the proposed architecture and systems.