Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

CPAM image extract tool

Hi Everyone,

We occasionally get requests to be able to export images from the CPAM database. Since they are embedded in the database itself it has been a challenge to get them out in the past.

I wrote this utility to make the extraction process easier to do.

 

Running the tool

There are a couple things you’ll need to do before it will work.

Get the MySQL password

To run the tool you’ll need to be able to get the MySQL password for the CPAM server and enter it into the php where the variable “$pw” is defined on line 4.

You will then need to enter the address of the CPAM server into the line where “$server_addr” is defined on line 7.

To get the MySQL password you’ll need to be logged in as root. Log in as ‘cpamadmin’ and use the following commands:
 

# sudo su -
# grep local.pass /opt/cisco/cpam/properties/cpsm.runtime.properties

The output will look like this:

[root@CPAM2 server]# grep local.pass /opt/cisco/cpam/properties/cpsm.runtime.properties

cpsm.runtime.store.local.pass=qdaQY1TMr7

[root@CPAM2 server]#

In this case we would want the password to be assigned like this:

$pw = " qdaQY1TMr7";

 

Get the tool  copied onto a Webserver

The utility is written in php.  You don’t need to know php to use it, but the CPAM servers don't run php so you'll need to run it on another web server.   

I was able to run it on my PC after installing XAMPP.  I just copied it into the C:\xampp\htdocs directory.  I was then able to use this URL:

 

http://127.0.0.1/imageextract-131.php

If you copy the file over to a linux system, remember to make it executable.  Here's what that command looks like:

 

#  chmod +x imageextract-131.php

Usage Notes:

This will try to pull all the images, even previous versions of a person’s badge picture. It will name the files after whoever it thinks the owner is or was. The image files will have a sequence number if it finds previous versions of the badge image for a given user. This is determined by the order the tool finds them in the image table, not by age.

 

This has been tested with CPAM 1.3.0 and 1.3.1

When the tool runs successfully you will be presented with a "zipped_images.zip" link to download.

 

Feedback

I'd love to get your feedback on how this worked for you.  Let  me know what you like about it, what you don't like about it, and what  suggestions you have for it.  Of course, I also want to know if you run into any problems caused by the script.   I can't fix it if I don't know it's broken.

This script is not  officially supported by our development team, but I will try to fix it if something is wrong.

 

Scenario 2:

Problem:

Has anyone had an issue with the Monitoring and or Command  links not working in the CPAM admin web interface?  User have rebooted the server and the issue persists.   After login he/she see the monitoring / status page however if he navigate away he cant get back by clicking on the Monitoring link, only by back button.  Command link is not working at all.   

Solution:

i had been working with a customer on the same issue today, i was able to get though by restarting the stop and start of cpam admin and cpamacserver service.
Please use IE 8 or 9 or fire fox. chrome is not supported.

 

Comments
Community Member

Sir,

May I ask, how exactly does your tool extract the actual image?  Or how are the images embedded in the database?

829
Views
4
Helpful
1
Comments