Looking for a simple way to see what OpenStack services are enabled, running, or dead on an OpenStack Compute or Controller Node, and also want to see when these services were started? Then check out this simple function that you can add to root’s .bashrc. Note that I do not take credit for writing this (did modify it a tiny bit, however), rather it is something a friend of mine passed on to me and I found it too handy not to document and share.
First append the following to /root/.bashrc.
[code language=”css”]
##Stack Stat Function
function stack_stat {
services=$( systemctl list-unit-files | egrep ‘(openstack|neutron)’ |awk ‘{print $1}’)
for service in $services ;do
echo -n "$service: "
systemctl status $service |grep Active
done
}
[/code]
What this function does is show you the status or “Active” (or enabled as you would traditionally say) OpenStack Services. Just run the following…
#stack_stat
You will see something similar to the output below, which shows you each enabled OpenStack service and its running status.
# stack_stat
neutron-dhcp-agent.service: Active: active (running) since Fri 2015-07-10 09:35:19 EDT; 3 days ago
neutron-l3-agent.service: Active: active (running) since Fri 2015-07-10 09:35:19 EDT; 3 days ago
neutron-lbaas-agent.service: Active: active (running) since Fri 2015-07-10 09:35:17 EDT; 3 days ago
neutron-metadata-agent.service: Active: active (running) since Fri 2015-07-10 09:35:17 EDT; 3 days ago
neutron-metering-agent.service: Active: active (running) since Fri 2015-07-10 09:35:17 EDT; 3 days ago
neutron-netns-cleanup.service: Active: inactive (dead)
neutron-openvswitch-agent.service: Active: active (running) since Fri 2015-07-10 09:35:19 EDT; 3 days ago
neutron-ovs-cleanup.service: Active: active (exited) since Fri 2015-07-10 09:35:19 EDT; 3 days ago
neutron-server.service: Active: active (running) since Fri 2015-07-10 09:35:29 EDT; 3 days ago
openstack-ceilometer-alarm-evaluator.service: Active: active (running) since Fri 2015-07-10 09:35:17 EDT; 3 days ago
openstack-ceilometer-alarm-notifier.service: Active: active (running) since Fri 2015-07-10 09:35:17 EDT; 3 days ago
openstack-ceilometer-api.service: Active: active (running) since Fri 2015-07-10 09:35:17 EDT; 3 days ago
openstack-ceilometer-central.service: Active: active (running) since Fri 2015-07-10 09:35:17 EDT; 3 days ago
Now compare the output above to the output of “openstack-service status” as shown below. Note that you do not get time and date stamps.
# openstack-service status
neutron-dhcp-agent (pid 6725) is active
neutron-l3-agent (pid 6724) is active
neutron-lbaas-agent (pid 3884) is active
neutron-metadata-agent (pid 3886) is active
neutron-metering-agent (pid 3882) is active
neutron-openvswitch-agent (pid 6726) is active
neutron-server (pid 3885) is active
openstack-ceilometer-alarm-evaluator (pid 3899) is active
openstack-ceilometer-alarm-notifier (pid 3897) is active
openstack-ceilometer-api (pid 3898) is active
openstack-ceilometer-central (pid 3895) is active
openstack-ceilometer-collector (pid 3893) is active
openstack-ceilometer-notification (pid 3890) is active
I know not a huge difference, but it’s still somewhat handy.