Double-click on the image to zoom-out ...Larger.
To return to Home page: Refresh Page or Take ESC Button on Keyboard
How to check resource availability for hosts using ansible ad-hoc commands.
We can use Ansible ad-hoc commands to check resource availability (CPU, memory, disk, etc.) on managed hosts. Here are some common checks:
1. Check CPU Usage
or using /proc/stat
:
2. Check Memory Usage
This will display total, used, and available memory in MB.
3. Check Disk Usage
This will list disk usage for all mounted filesystems.
To check a specific partition (e.g., /
):
4. Check Available Inodes
This checks the available inodes, useful for diagnosing filesystem issues.
5. Check Network Bandwidth Usage
(Requires sysstat
package installed.)
7. Check Uptime of Servers
This helps monitor how long a server has been running.
8. Check Running Processes
This lists the top 10 processes consuming the most memory.
9. Check Load Average
It displays the system’s load over the last 1, 5, and 15 minutes.
10. Check Open Ports
Lists active ports and services.
11. Check Swap Usage
This checks if swap is enabled and in use.
12. Check System Reboot Status
Shows the last system boot time.
13. Check Logged-in Users
Lists users currently logged in.
14. Check Available Package UpdatesFor Debian-based systems:
For RHEL-based systems:
15. Check Firewall StatusFor Ubuntu/Debian:
For RHEL/CentOS:
Running Commands as Root (with elevated privileges)
If a command requires root privileges, use -b
(become) to execute it with sudo:
twtech-Thoughts:
Ansible ad-hoc commands provide quick insights into system resource and availability.
For continuous monitoring, twtech integrates Ansible with:
Prometheus,
Grafana,
Datadog,
CloudWatch,
ELK (elasticsearch logstash and kibana)
Trivy operator.
No comments:
Post a Comment