Tuesday, January 29, 2013

Bulk PVLINE example

Hi,

This has been a busy week. As promised I will write something about Bulk collection and the pvline format. Please remember that you should always go back to the official documentation.

In TNPM, data can be collected using 2 modes: SNMP based or Bulk based. SNMP collection uses predefined formulas in TNPM (known as discovery / collection formulas) to query SNMP enabled devices and collect the necessary performance data. Bulk collection reads data from flat files.

Independent of the collection type used, the following steps will be necessary:
  1. Discover the elements/subelements that you will collect data from
  2. Collect the data for those elements/subelements using a predefined polling period
  3. Present the data using reports and charts (you can also export the data)
If using SNMP, you will use SNMP discovery formulas to create the elements and subelements with its properties. If using BULK, all discovery information will be available in the flat file (that we are going to call "pvline" from now on).

Internally, TNPM will create for each BULK and each SNMP collector a kind of "processing line" called subchannel. For SNMP the first component in this processing line would be called something similar to SNMP.1.2 (channel 1, subchannel 2), and for BULK something like BCOL.2.3 (channel 2, subchannel 3).

The file is written in a format called PVLINE (full definition here). You can see an example below:

Type Both 
OPTION:Type=Line 
OPTION:PVMVersion=3.0 
OPTION:Element=NETD1
# Inventory Section
G1998/08/12 23:30:00 | Family | alias | NETD1_CPU1 |  | inventory | NETD_CPU
G1998/08/12 23:30:00 | Label | alias | NETD1_CPU1 |  | inventory | CPU C1
G1998/08/12 23:30:00 | Invariant | alias |  | NETD1_CPU1 | inventory | invcpu1
G1998/08/12 23:30:00 | Instance | alias | NETD1_CPU1 |  | inventory | cpu_<1>
G1998/08/12 23:30:00 | Slot | alias | NETD1_CPU1 |  | property | S1
G1998/08/12 23:30:00 | Frequency | alias | NETD1_CPU1 |  | property | 1GHz
(...)
OPTION:Element=NETD2
G1998/08/12 23:30:00 | Family | alias | NETD2_CPU1 |  | inventory | NETD_CPU
G1998/08/12 23:30:00 | Label | alias | NETD2_CPU1 |  | inventory | CPU C1
G1998/08/12 23:30:00 | Invariant | alias |  | NETD2_CPU1 | inventory | invcpu1
G1998/08/12 23:30:00 | Instance | alias | NETD2_CPU1 |  | inventory | cpu_<1>
G1998/08/12 23:30:00 | Slot | alias | NETD2_CPU1 |  | property | S1
G1998/08/12 23:30:00 | Frequency | alias | NETD2_CPU1 |  | property | 1GHz
(...)
# Data Section
G1998/08/12 23:30:00 | AP~Specific~Bulk~NETD_CPU~CPU_idle_pct | alias | NETD1_CPU1 |  | float | 25.00
G1998/08/12 23:30:00 | AP~Specific~Bulk~NETD_CPU~CPU_user_pct | alias | NETD1_CPU1 |  | float | 35.00
G1998/08/12 23:30:00 | AP~Specific~Bulk~NETD_CPU~CPU_system_pct | alias | NETD1_CPU1 |  | float | 40.00
(...)
G1998/08/12 23:30:00 | AP~Specific~Bulk~NETD_CPU~CPU_idle_pct | alias | NETD2_CPU1 |  | float | 35.00
G1998/08/12 23:30:00 | AP~Specific~Bulk~NETD_CPU~CPU_user_pct | alias | NETD2_CPU1 |  | float | 40.00
G1998/08/12 23:30:00 | AP~Specific~Bulk~NETD_CPU~CPU_system_pct | alias | NETD2_CPU1 |  | float | 25.00
(...)
G1998/08/12 23:45:00 | AP~Specific~Bulk~NETD_CPU~CPU_idle_pct | alias | NETD1_CPU1 |  | float | 10.00
G1998/08/12 23:45:00 | AP~Specific~Bulk~NETD_CPU~CPU_user_pct | alias | NETD1_CPU1 |  | float | 60.00
G1998/08/12 23:45:00 | AP~Specific~Bulk~NETD_CPU~CPU_system_pct | alias | NETD1_CPU1 |  | float | 30.00
(...)
G1998/08/12 23:45:00 | AP~Specific~Bulk~NETD_CPU~CPU_idle_pct | alias | NETD2_CPU1 |  | float | 20.00
G1998/08/12 23:45:00 | AP~Specific~Bulk~NETD_CPU~CPU_user_pct | alias | NETD2_CPU1 |  | float | 70.00
G1998/08/12 23:45:00 | AP~Specific~Bulk~NETD_CPU~CPU_system_pct | alias | NETD2_CPU1 |  | float | 10.00

When creating the pvline it is mandatory to add the ".pvline" extension in the filename (bfile.pvline for example).

Some important details about the pvline format (and common mistakes):
  1. Please be careful with typos. Using "TYPE Both" can be different than "Type Both"
  2. The file content must be in time sequence. The collector will ignore any line older than the last line read.
  3. You can split the file into two main sections: The inventory section (lines with "inventory" or "property" in the example above) and the data section (lines with "float"). In the official documentation, you will see that the inventory and data sections are mixed. This is only useful if your inventory data for the same subelement will change inside the same file for different timestamps. If that is not the case, just write all inventory lines in the beginning of the file using the oldest timestamp ( "G1998/08/12 23:30:00" in our example) and then put all data after it.
  4. The "OPTION:Element=" is only necessary in the inventory section. You don't have to put it in the data section
  5. Please notice that the formula path does not contain "~" in the beginning. This is a very common error.

That is it. Once you have the BCOL running and you move the pvline file in its input directory, the file will be processed.

Talking about the file processing, some important points are listed below:
  1. When using BULK collection, three facts must be true before any data can be stored in the database:
    1. The subelement(s) must exist and be active
    2. The collection formulas must exist and the formula requests must be configured and active in the RequestEditor
    3. The oldest timestamp present in the file must be equal or newer than the last timestamp read by the BCOL. 
  2. If configured to do the discovery, the BCOL will generate a new inventory file after every discovery time window (usually 60 min) of data processed. Please notice that the time window is related to the processed data, meaning that if your pvline file contains data from 09:00 until 12:30, it will generate 3 discovery files, one when processing the data for 10:00, another at 11:00 and another at 12:00.
  3. The first processed hour for a new subelement is always discarded, once the subelement won't exist until the discovery window is reached and the inventory file created and processed.

26 comments:

  1. Hello Danilo,

    Thanks a lot for sharing the information - we're investigating the usage of BCOL to handle text files.
    We're more or less familiar with SNMP discovery and data collection implementation but BCOL is
    a different story.

    In order to understand BCOL/pvline data processing properly, we'd like to implement a simple
    scenario based on your pvline file with discovery configured.

    Could you please help us with such scenario setup ?

    Here are questions:

    1. The collection formula - what should be in the contents of formula in case of BULK collection ?
    Could you please provide an example, based on your pvline sample ?

    2. Discovery - will sub-elements be created in TNMP if we set DISCOVERY_MODE to "sync_inventory" ?
    How differences (I mean inventory changes) will be handled in case of BULK collection ?

    Thanks !

    ReplyDelete
    Replies
    1. Hi Alexander

      No problem to help you with the setup. I'm using BCOL collection for a long time and I will be happy to help. Please find below the answers to your questions:

      1. The collection formula - what should be in the contents of formula in case of BULK collection ?
      Could you please provide an example, based on your pvline sample ?

      Answer: The collection formula should be empty. You just have to create it and add it to the requestEditor.

      2. Discovery - will sub-elements be created in TNMP if we set DISCOVERY_MODE to "sync_inventory" ?

      Answer: Yes, it is mandatory to set the DISCOVERY_MODE to "sync_inventory" in order to create the subelements. Please keep in mind that the BCOL will create on inventory file per processed hour (this file will be transmitted to the DataMart server using FTP or SFTP). In theory you don't even have to create the inventory profile, it will be created automatically with the name "bulk_<# subchannel>". Also, don't forget to add the "pollinv" command to the crontab in the DataMart server. This command will consume the inventory file for the BCOL. If this is not in the cron, the BCOL will keep waiting until the command is executed.

      How differences (I mean inventory changes) will be handled in case of BULK collection ?

      Answer: The inventory process will follow the same steps as for SNMP. After the profile is created, you can change some parameters (like grouping rules to be executed or sync actions) as you do for SNMP. The only real difference is that the BCOL will push the inventory files towards the Datamart for every processed hour.

      I hope it can help you to start.

      Please let me know if any other question

      KR,

      Danilo Luna

      Delete
  2. Hi,

    Thank you for the explanation and your assistance.
    I already tried to setup this scenario - the inventory part seems to be working, but I'm stuck with
    metrics collection.

    I would like to provide a listing of steps I performed on my environment and their outcomes, but
    the message size is restricted to 4096 bytes - probably you may point me to a right direction.
    Please let me know how to send the file with details.

    Thank you in advance

    ReplyDelete
  3. Hi Danilo,

    Could you please explain me how the Elts/SEs are created in bulk?Because i caoont see the SE's or Elts even after the files are being processed.

    Regards,
    Animesh

    ReplyDelete
  4. Hi Danilo,

    Our Bulk UBA, CME and FTE are processing old files i.e. files older than 2 days. As a result, the data is getting missed. I have removed all the files from these components and bounced them. I have also removed the currently available files from the collector and restarted it but the issue is not solved. Also, even after removing the older files from the collector, they are still present in the collector and the files are still being processes by DC compoenets. Can you help me how to proceed here?

    ReplyDelete
    Replies
    1. Hi Prashanth,

      Which component is dropping the data? If you follow the files in the /output directories, until which component you can see the mentioned data?

      Also, when you said you removed all files from the components and bounced them, did you mean the state directory as well? It has been a while since I've worked with BCOLs but if I'm not mistaken, once you clean start the BCOL (remove all files including the state files and bounce), the BCOL will discard everything older than its startup time. So if you clean started it now, all datapoints older than "now" will be discarded by the BCOL and no output file will be generated until you send recent data.

      KR,

      Danilo

      Delete
    2. Hi Danilo,

      No component is dropping the data. The data flow from UBA to FTE to CME is getting delayed gradually. I have removed all the pvline files from the do,done and output directories of all the three components and also the state directories. Then I have restarted the components. After restart, the UBA received the current files from the data loader and started processing them. Here is where the problem is. The files are getting processed so slowly that after three days of this restart process, it is still processing the first file i.e file three days old. This delay is getting increased gradually. This slow processing is resulting in data loss.

      Delete
    3. Hi Prashanth,

      In this case it is most probably a performance issue. Check the CPU and memory on the UBA server. Is this an official UBA or you developed one yourself? Check also if you don't have more than one UBA running at the same time. It may happen that because it takes too long to process a file, another UBA process starts in parallel and reads the same input file that is being processed, consuming all system resources.

      Delete
  5. Hi Dannilo , thank you; is nice to find information about this tool .. i hadn't found information about how work and how you write a file to Collector bulk pvline...

    Im first surprise when my boss tells me , we have to convert the xml client's performance file to pvline file format ...
    I was thinking that the task or purpose of the file pvline would be transform the XML file that will give us our customers ..

    and this are my doubts...

    You tell us that we have created the formulas ...
    but the formula editor only allows me to SNMP OID or formulas ... it is in the same way ? ... Otherwise the formula can not be empty , in this case the SNMP formula should have something in the field "data of formula"

    Another little formulas ... About the " Formua selector" I do not see the folder AP | specific | Bulk ... is empty; is normal? or installed the tool bad or i have to install a teckpack

    Thanks again for this blog and share tips and knowledge ...

    Excuse me for all this amount of doubts and questions

    ReplyDelete
  6. Hi Fabian,

    You indeed need to create the bulk formulas in TNPM in order to be able to collect bulk metrics. You can use the Formula Editor to do it (just create a collection formula with some comment inside :). You can also use the resmgr to import a collection formula (easier if you have many formulas to create). Check this link to see how to do it:
    http://www-01.ibm.com/support/knowledgecenter/SSBNJ7_1.4.1/cli_guide/ctnpm_cli_guide_mngdesign_15.dita?lang=en

    About the "AP" folder, this is completely customizable. You can use any path you want when you create the bulk formula. Just make sure the pvline content matches the formula path used.

    Danilo

    ReplyDelete
  7. Hi Danilo, Last night i found that i could create a formula with a comment..

    thank you...
    again thank you

    ReplyDelete
  8. Hi Danilo.... me and my questions...
    Now we have a example pvline.... but the date of the pvline is 1998.. and the problem is thist:

    COMPONENT APPLICATION HOST STATUS ES DURATION EXTENDED STATUS
    BCOL.1.1 BCOL ***PMCLDP running 19 state change to: pendingInventoryFinishedin hour 1998.08.17-17.00.00


    The BCOL is in this status "pendingInventoryFinishedin" and there isnt processing new pvline...

    Is there any command to update or kill or terminate the inventory...


    Again Thank you to help us

    ReplyDelete
    Replies
    1. Hi Danilo...

      thanks you for us.....

      the "pollinv" command is added to crontab in the datamart server... the solution was undeploy and deploy de Bulk collector and the pvline have the correct date....


      Now we are waiting to see the .BOF files.... but i am seeing one thing that no is not normal... Im seeing this mesagge :

      V1:659 2015.10.21-20.43.54 UTC LDR.1-29258:12740 MISSING_INPUT_COMPONENT GYMDC10036W Missing input PvUrl for component named: CME.1.2018

      i dont know if that error or warning is normal or stop me create files .bof files...

      Again thank youu..

      IBM would be create a tool to create adapters(pvlines) in a graphical form...

      :S

      :)

      Thank you

      Delete
    2. Hi Fabian,

      this won't interfere with the .BOF creation. The loader is trying to get files from CME.1.2018 (a cross collection cme). You should be able to see it in the topology editor (and delete it if you wan't).

      KR

      Danilo

      Delete
    3. Hi Danilo,

      Again me and my problem... first thank you again....

      Now the problem... our collector is working, is creating the elements and the subelements, the problem is the CME, in its log, we are watching this :

      BAD_RECORD GYMDC10401W Metric record PvMetricRecord (mid=100001155, rid=200001460, date=2015.11.05-22.00.00[1446760800], value=1980.0) not specified by requests PvMetricRecord (mid=100001155, rid=200001460, date=2015.11.05-22.00.00[1446760800], value=1980.0)| not specified by requests


      And in the pvline, we are steting the formula name:

      OPTION:TYPE=Line
      OPTION:PVMVersion=3.0
      OPTION:Element=XXX

      G2015/11/05 22:05:00|Family|alias|XXX_PERFORMANCE||inventory|USN
      G2015/11/05 22:05:00|AP~LTE~HUAWEI~EPC~MME~Test|alias|USNBAQ2HW_PERFORMANCE||float|980


      And the subelements and elements are creating, and in the request editor are selected the formula in the correct group...

      PD: Can you give your email to contact and talk about business..

      Thank Again

      Delete
    4. Hi Fabian,

      As the error indicates, the CME doesn't have a request specified for the metric (AP~LTE~HUAWEI~EPC~MME~Test~USNBAQ2HW_PERFORMANCE) and the resource 200001460 (your subelement) for the specified timestamp. Please double check the request editor entry to make sure the collection group and the metric are well linked. If that is the case, try to deactivate the request, save it , activate it again and save. Bounce the CME, and wait for bulk entries older than the request creation timestamp. The CME will ignore metrics older than the request creation timestamp.

      If you want to talk about something else, you can find me at danilo.luna_at_gmail_dot_com

      KR

      Danilo

      Delete
    5. Hi danilo, i had readed in an another blog entry(yours) and you talk about this:

      Is the subelement in the correct folder in the collection tree?
      Open the "pvm", go to the "resource editor" and check if the subelement is in the correct collection folder. If not, please check your grouping rules using the "rule editor".


      When i checked the resource editor and when i click in Subelement Group, I dont see my subelements... I have to see the subelements in the tabs "Sub elements group"?

      The last thing can be a root cause why i see the "BAD_RECORD GYMDC10401W " in the log

      Delete
  9. Hi Fabian,

    Do you have the "pollinv" command added to crontab in the datamart server (more precisely the server where the DISC process is running)? You must call this command to execute the data inventory for the collected data. Please make sure the command is running and check the inventory logs for more details. If everything is fine you should have a profile called "bulk_#" where # is the number of your bulk.

    For more information, please check:

    http://www-01.ibm.com/support/knowledgecenter/SSBNJ7_1.4.1/dm_config_op/ctnpm_dm_config_op_Discovery_57.dita?lang=en

    ReplyDelete
  10. Hi Danilo,

    We have moved one PVLINE file processing from one UBA to another UBA process on 15th JAn. But I cannot see any data for it.
    Moved PVLINE files processing well in UBA.5.100 and FTE.5.100.In CME.5.100 do and done directories, I can see the processed data (NRAW files) but in output directory I can see only BEAT files.

    Also we are looking standard procedure of moving PVLINE file processing from one UBA to another UBA. This process nowhere mentioned in the TNPM documents.

    Please advice on it.

    Thanks,

    ReplyDelete
    Replies
    1. Hi,

      Indeed there is no documentation mentioning how to move elements between UBAs, but I believe it would be similar to the process described here:

      https://tnpmsupport.persistentsys.com/sites/all/themes/startupgrowth/1.3.2/wireline/pdf_tnpm_moving_elements.pdf

      In the CME's point of view, it really doesn't matter if the data is coming from a SNMP collector or UBA. Once it is parsed and converted to a BOF file, the data is treated exactly the same way.
      So, in your case, the CME is discarding all data because the elements in the BOF file are not linked to it in the DB.

      Unfortunately, this is something I never tried before and cannot advise on how to solve it, but the direction to follow is this. You have to somehow tell the CME that the elements are now linked to its subchannel. If you have a lab system, you can try to follow the documentation above, replacing "SNMP" by "UBA" and see how it goes.

      If you find a solution, please let us know.

      Delete
  11. HI Danilo,

    need one suggestion to process the BCOL data file.

    Timestamp: 1527680272


    epoch to GMT Customer name Inbound current session Outbound Active Sessions
    Wednesday, May 30, 2018 11:37:52 AM freisestat 192 189
    Wednesday, May 30, 2018 11:37:52 AM intreisstat 982 197
    Wednesday, May 30, 2018 11:37:52 AM int-freistat 169 172


    we need to process in BCOL collector, BCOL collector is processing the data:

    BCOL.1.201 BCOL DEFR2ERDD running 1 pending input after time: nil

    ReplyDelete
    Replies
    1. Hi

      what exactly are you trying to do? The data you gave as an example cannot be processed as it is. It needs to be converted to the PVLINE format (see above) before it can be processed by the BCOL. You need to do it using a script.

      After you convert it, you can feed it to the BCOL for processing

      Delete
    2. HI Danilo,

      Thanks for the feedback.
      let us say for one customer is this will accept by bcol, if we put this file format suppose in bcol input dir, will it be processed by BCOL collector.



      Type Both
      # #
      # #
      # # Setting Options
      OPTION:Type=Line
      OPTION:PVMVersion=3.0
      # OPTION:TimeOffset=0
      # OPTION:FormulaPath= AP~Specific~Bulk~(device)
      # # Collection Interval for the following resources = 15 minutes
      OPTION:Element=BigRouter
      #
      G2018/05/30 11:37:52 | Family | alias | Abcd | | inventory | Cisco
      G2018/05/30 11:37:52 | Customer | alias | Abcd | | property | freisestat
      G2018/05/30 11:37:52 | Inbound current session | alias | Abcd | | float | 192
      G2018/05/30 11:37:52 | Outbound Active Sessions | alias | Abcd | | float | 189

      Kindly provide the feedback.

      Thanks

      Delete
    3. You are mixing the inventory with the data. The data must use a full path to a collection formula that exists

      Delete
  12. Also the timestamp we are using to process is Wednesday, May 30, 2018 11:37:52 AM
    if we process the in input file today, as the timestamp is old will it be processed by BCOL.

    ReplyDelete
    Replies
    1. As mentioned above, it does not matter if the data is in the past as long as it is newer than the BCOL current processing time. When you start the BCOL for the first time, this value is undefined and will be set according to the first file processed, even if the file has data from the past.

      Delete