Jump to content


Photo

Monitor Adobe FMS (Flash Media Server) in Cacti via SNMP


  • Please log in to reply
No replies to this topic

#1 John

John

    Administrator

  • Administrators
  • 73 posts

Posted 24 November 2013 - 11:04 AM

If you are using Cacti to monitor your servers and you have a server running Adobe FMS, then it would be nice to monitor the connected clients (for example) in Cacti. 
 
gM.png
 
Because Adobe FMS doesn't support snmp, you'll have to create another way. We created a script and configured SNMP to use that script. Via SNMP the results will be passed to Cacti (but you can use any other monitoring server also of course). 
 
UPDATE: Make sure php-xml and net-snmp-tools are installed on the server. 
 
Step 1: 
 
Make sure the admin API over HTTP is enabled in <em>/opt/adobe/fms/conf/fms.ini</em>
 
USERS.HTTPCOMMAND_ALLOW = true
Step 2:
 
You'll need to give a user access to the HTTP commands. Enable the methods you need or use a keyword “All” in /opt/adobe/fms/conf/Users.xml
 
<AdminServer>
    <HTTPCommands>
        ...
        <Allow>All</Allow>
        <Deny></Deny>
        <Order>Deny,Allow</Order>
    </HTTPCommands>
</AdminServer>
Step 3:
 
Place this PHP script somewhere on the server, for example /usr/local/fmsstats/stats.php. Change $adminUser and $adminPassw. 
 
<?php


$adminUser='admin';
$adminPassw='secretpassword';


$xml = new DomDocument();
$url = "http://127.0.0.1:1111/admin/getServerStats?auser=$adminUser&apswd=$adminPassw";
$xml->load($url);


if( !isset( $argv[1] ) )
    $argv[1] = 'connected';


$output = getTagContents( $argv[1], $xml);


die( $output );


function getTagContents($tagName,$dom) {
    $node=$dom->getElementsByTagName($tagName)->item(0);
    return $node->nodeValue;
}
?>
Step 4:
 
Edit your snmpd.conf (<em>/etc/snmp/snmpd.conf</em>) and add this:
 
extend .1.3.6.1.4.1.2021.8.3000 fmsConnected /bin/php /usr/local/fmsstats/stats.php connected
Step 5:
 
Do a snmpwalk on your server like this: 
 
[root@server fmsstats]# snmpwalk -v2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.8.3000
UCD-SNMP-MIB::extTable.3000.1.0 = INTEGER: 1
UCD-SNMP-MIB::extTable.3000.2.1.2.12.102.109.115.67.111.110.110.101.99.116.101.100 = STRING: "/bin/php"
UCD-SNMP-MIB::extTable.3000.2.1.3.12.102.109.115.67.111.110.110.101.99.116.101.100 = STRING: "/usr/local/fmsstats/stats.php connected"
UCD-SNMP-MIB::extTable.3000.2.1.4.12.102.109.115.67.111.110.110.101.99.116.101.100 = ""
UCD-SNMP-MIB::extTable.3000.2.1.5.12.102.109.115.67.111.110.110.101.99.116.101.100 = INTEGER: 5
UCD-SNMP-MIB::extTable.3000.2.1.6.12.102.109.115.67.111.110.110.101.99.116.101.100 = INTEGER: 1
UCD-SNMP-MIB::extTable.3000.2.1.7.12.102.109.115.67.111.110.110.101.99.116.101.100 = INTEGER: 1
UCD-SNMP-MIB::extTable.3000.2.1.20.12.102.109.115.67.111.110.110.101.99.116.101.100 = INTEGER: 4
UCD-SNMP-MIB::extTable.3000.2.1.21.12.102.109.115.67.111.110.110.101.99.116.101.100 = INTEGER: 1
UCD-SNMP-MIB::extTable.3000.3.1.1.12.102.109.115.67.111.110.110.101.99.116.101.100 = STRING: "393"
UCD-SNMP-MIB::extTable.3000.3.1.2.12.102.109.115.67.111.110.110.101.99.116.101.100 = STRING: "393"
UCD-SNMP-MIB::extTable.3000.3.1.3.12.102.109.115.67.111.110.110.101.99.116.101.100 = INTEGER: 1
UCD-SNMP-MIB::extTable.3000.3.1.4.12.102.109.115.67.111.110.110.101.99.116.101.100 = INTEGER: 0
UCD-SNMP-MIB::extTable.3000.4.1.2.12.102.109.115.67.111.110.110.101.99.116.101.100.1 = STRING: "393"
In this example UCD-SNMP-MIB::extTable.3000.3.1.1.12.102.109.115.67.111.110.110.101.99.116.101.100 gives the connected users. So we are going to use this snmp OID in Cacti. 
 
Step 6:
 
In Cacti, go to Console-> Devices -> your server. Then add the graph template "SNMP - Generic OID Template". Then click Create Graphs for this Host and select "Create: SNMP - Generic OID Template". Click Create. 
 
Fill in the appriopriate fields. In the OID you put in the OID you found at step 5: UCD-SNMP-MIB::extTable.3000.3.1.1.12.102.109.115.67.111.110.110.101.99.116.101.100
 
Create the graph and wait for Cacti to poll. You should see the connected users in a while!
 
Extra possibilities:
 
Via your browser, go to the following URL. Change x.x.x.x to the server's IP address and change USERNAME / PASSWORD.  
 
 
You'll get an XML output. Just find whatever you want to send to Cacti and use it as a parameter for the php script. For example:
 
<io>
<msg_in>166400</msg_in>
<msg_out>10619347</msg_out>
<msg_dropped>1014</msg_dropped>
<bytes_in>51052177</bytes_in>
<bytes_out>10869434168</bytes_out>
<reads>354236</reads>
<writes>363640</writes>
<bw_in>7253</bw_in>
<bw_out>11934505</bw_out>
<total_connects>912</total_connects>
--SNIP--
</io>
If you want to graph the total connects to the FMS server, simply use this in snmpd.conf:
 
extend .1.3.6.1.4.1.2021.8.3001 totalConnects /bin/php /usr/local/fmsstats/stats.php total_connects





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users