Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Extending WHMCS Server Revenue Forecasts Report with solusvm nodes - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Extending WHMCS Server Revenue Forecasts Report with solusvm nodes

2

Comments

  • DamienSBDamienSB Member
    edited February 2013

    Yes i could, but you would have to manually insert that information. I may release an update that includes more features.

    Edit: This also was meant to calculate gross revenue, not profit/net revenue.

  • I did the Sync Node List first and it showed me a list of my nodes.
    I have a mix of KVM and Xen nodes and I'm running SolusVM both in :443 and :5656 ports.

    I'll try changing to :443 and will let you know.

    Thanks!

  • @George_Fusioned Let me know if you can't get it working.

  • I'll try this later on.

  • never use this.

  • why you need this?

  • insight into how company money is being spent is always useful when you have a large number of nodes. im on a phone so ill let someone else inform you what can be determined from revenue reporting tools.

  • also, can someone throw up some screenshots?

  • the report. (with blured information)

  • OK now I know why it's not working for me, I had my SolusVM /api/admin directory password protected...

    I removed the password protection and now it only brings back Node 1 (localhost) when I run the "Sync Node List".

  • Ok then the script is only returning openvz nodes. I was afraid of that. The api call i use requires that the "type" be used. If you change the array to have the two visualization types you use and run the sync command for each type it should populate the table with all the nodes. I put all 4 types in the call, but i guess it is only calling the first (openvz).

    I am not home right now, but i will release an update that should include the other 3 types by Monday.

    Sorry about that george! You're my beta tester.

  • No worries :)

    I changed the code to only include 'kvm' and it did bring back the KVM nodes successfully.
    Then I also did the Sync Products/Services which brought back the correct Node ID for every VPS, BUT it didn't populate into the nodeid field of any product. So Count = 0 for all KVM nodes.

    I manually added the nodeid to some VPSs, and I see that now the report does show amounts for those.

    A problem I'm probably going to face is that I use 3 currencies (GBP, USD, EUR) while from what I see the script assumes that all amounts are in the default currency.

    Anyway, it's Saturday night ;) Have fun, and we'll check it out on Monday.

    Cheers!

  • May require some fooling around for multi-currency.

  • I've given it a whirl too. Doing the sync for products doesn't seem to have returned any node ids in to whmcs at all.... Though it is still running.

  • KuJoeKuJoe Member, Host Rep

    Worked perfect for me for our OpenVZ node. We don't really need it for our Xen or KVM node.

  • @MartinD said: I've given it a whirl too. Doing the sync for products doesn't seem to have returned any node ids in to whmcs at all.... Though it is still running.

    Make sure that the table has all the nodes listed below before syncing products and services.The script uses the local table to store referenced data in the process. Also make sure that the nodeid product field is setup the right way aswell.

  • Yep, checked that. Nodeid field is correct and all nodes are displayed correctly.

    Dunno if its just a case of waiting though as the db is quite large.

  • @KuJoe said: Worked perfect for me for our OpenVZ node. We don't really need it for our Xen or KVM node.

    Awesome! Back to a comment made a little earlier by someone else: What information or insight will you obtain with this report? How is this useful in your opinion?

    Im wondering what insight other providers are wanting from this report so i can make adjustments to improve its usefulness.

    @Kujoe, would you want this report to calculate [per node gross revenue - node expense] like the other WHMCS report does?

  • @MartinD said: case of waiting though as the db is quite large.

    Could be! The script is making a call to the solusvm api for each product/service. This can take some time. Wait for the script to complete to see if it is working.

    If the script is already printing out information, does it say - New Node id:### ? and is that information correct?

  • I can see the api calls, so that part is running fine, just not seeing anything coming up in whmcs unfortunately.

    the nodes are listed after a node sync. It displays the node name and then figures under monthly etc. They are all 0.00 though of course.

  • KuJoeKuJoe Member, Host Rep

    @DamienSB said: Awesome! Back to a comment made a little earlier by someone else: What information or insight will you obtain with this report? How is this useful in your opinion?

    Im wondering what insight other providers are wanting from this report so i can make adjustments to improve its usefulness.

    @Kujoe, would you want this report to calculate [per node gross revenue - node expense] like the other WHMCS report does?

    I think the report is good like it is now. I will let my partner review it and I'll post his feedback here since he's the one that would mainly be using this information for our reporting/records.

  • jack, martind, can you move the issues to pm? it is a little hard to keep it sorted with all the other comments gojing around.

  • Will do..once its 'finished'?

  • For everyone that just added the nodeid field to their products, the mysql update query which updates the nodeid field doesn't work because the field is empty (= there's no reference of it in tblcustomfieldsvalues).

    I have added a '0' to the nodeid field of a few services, and when I re-ran the script, the field got updated with the correct Node ID.

    So we probably need to populate the nodeid field of all products with zeroes first, and then run the script.

  • I feel some mysql hackery coming on.

  • DamienSBDamienSB Member
    edited February 2013

    @MartinD said: Will do..once its 'finished'?

    it will never be complete.

  • Sorry, that sounded like a dig, wasn't meant in that tone at all :)

  • DamienSBDamienSB Member
    edited February 2013

    @MartinD said: I feel some mysql hackery coming on.

    The code is clear to view, you can look at the SQL statements yourself.

    EDIT: oh, didnt sound like a dig at all, the script clearly has some issues and fixes are planed to be made.

  • Nice script! I changed it quick and dirty to this. It should be get all nodes:

    if($_GET["action"] == "import") { $vttypes = array('openvz', 'xen', 'xen hvm', 'kvm'); foreach($vttypes as $vttype){ $tblserverid = $_POST["server"]; $tblresult = mysql_query("SELECT * FROMtblserversWHERE id='$tblserverid' LIMIT 1"); $tblserver = mysql_fetch_array($tblresult, MYSQL_ASSOC); $apiuser = $tblserver['username']; $apipass = $tblserver['password']; $values["password2"] = $apipass; $apiresult = localAPI("decryptpassword", $values); $apipass = $apiresult['password']; $url = "https://".$tblserver['ipaddress'].':5656/api/admin/command.php'; $postfields = array('id' => $apiuser, 'key' => $apipass, 'action' => 'node-idlist', 'type' => $vttype); $options = array('SSL_VERIFYPEER' => 'false', 'SSL_VERIFYHOST' => 'false', 'HEADER' => '0', 'CURLOPT_TIMEOUT' => '30'); $response = curlCall($url, $postfields, $options); preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $response, $match); $result = array(); foreach($match[1] as $x => $y) { $result[$y] = $match[2][$x]; } $nodesu = explode(',', $result['nodes']); foreach($nodesu as $nodeid) { $url2 = "https://".$tblserver['ipaddress'].':5656/api/admin/command.php'; $postfields2 = array('id' => $apiuser, 'key' => $apipass, 'action' => 'node-statistics', 'nodeid' => $nodeid); $options2 = array('SSL_VERIFYPEER' => 'false', 'SSL_VERIFYHOST' => 'false', 'HEADER' => '0', 'CURLOPT_TIMEOUT' => '30'); $response2 = curlCall($url2, $postfields2, $options2); preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $response2, $match2); $result2 = array(); foreach($match2[1] as $x => $y) { $result2[$y] = $match2[2][$x]; } $queryn = mysql_query("SELECT * FROMmod_vpsnodereportWHERE id='$nodeid' LIMIT 1"); $numr = mysql_num_rows($queryn); $nameu = $result2['name']; if($numr == "1") { mysql_query("UPDATEmod_vpsnodereportSET name='$nameu' WHERE id='$nodeid' LIMIT 1"); } else { mysql_query("INSERT INTOmod_vpsnodereportVALUES ('$nodeid', '$nameu')"); } } } $reportdata["headertext"] .= "<div class='successbox'>The list of nodes have been imported!</div>"; }

  • @fileMEDIA said: Nice script! I changed it quick and dirty to this. It should be get all nodes:

    i reuploaded the report file with a fix for the "not listing anything other than openvz". I am going to look into the issue when solusvm isnt using the default ports next

Sign In or Register to comment.