Skip to content

Commit

Permalink
Fixes #6432: We need a command to show rudder detailed informations
Browse files Browse the repository at this point in the history
  • Loading branch information
peckpeck committed Mar 24, 2015
1 parent 7b43fd1 commit 5499f84
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions share/commands/agent-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh
# @description Display a summary of agent informations

UUID=$(cat /opt/rudder/etc/uuid.hive 2>/dev/null)
[ $? -ne 0 ] && UUID="Not yet configured"

HASH=$(openssl dgst -sha1 /var/rudder/cfengine-community/ppkeys/localhost.pub 2>/dev/null)
[ $? -ne 0 ] && HASH="Not yet configured"
HASH=$(echo "${HASH}" | sed -e 's/.*= //')

POLICY=$(cat /var/rudder/cfengine-community/policy_server.dat 2>/dev/null)
[ $? -ne 0 ] && POLICY="Not yet configured"

ROLES=$(ls -m /opt/rudder/etc/server-roles.d/ 2>/dev/null)
if [ $? -ne 0 ]; then
ROLES="rudder-agent"
else
ROLES=", rudder-agent"
fi

if [ -e /opt/rudder/etc/disable-agent ]; then
ENABLED="disabled"
else
ENABLED="enabled"
fi

echo "UUID: ${UUID}"
echo "Key Hash: ${HASH}"
echo "Policy server: ${POLICY}"
echo "Roles: ${ROLES}"
echo "Agent is ${ENABLED}"

0 comments on commit 5499f84

Please sign in to comment.