Class: NodeHostProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/gui/node_host_property.rb

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ NodeHostProperty

Returns a new instance of NodeHostProperty.



1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
# File 'lib/gui/node_host_property.rb', line 1456

def initialize (node)

@color_style = [$red, $orange, $yellow, $blue]

window=Gtk::Window.new
#we need window to be a class variable to be accessible from account_frame sub error window
@window=window
window.set_transient_for($win)
window.set_title("Node property of "+node.ip+"/#{node.netmask}")
window.set_size_request(450, 450)
window.set_modal(true)
vboxb = Gtk::VBox::new
window.add vboxb
vboxb.show	

notebook = Gtk::Notebook::new()
notebook.set_tab_pos(Gtk::POS_TOP)
vboxb.add notebook
notebook.show

################################ status tab #########

frame = Gtk::Frame::new
frame.border_width=10
frame.set_size_request(300, 290)
frame.show

vbox = Gtk::VBox::new(false,2)
vbox.show
frame.add vbox 

frame_st=Gtk::Frame.new("General")
frame_st.border_width=10
table_st = Gtk::Table.new(1,2,false)
table_st.show
label_status = Gtk::Label.new "Current"
label_status.show
entry_status = Gtk::Entry.new
tstyle=Gtk::Style.new
rgb=hexa_to_rgb_color($status_color[$status_value[node.status]])
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_status.set_style(tstyle)
entry_status.set_text($status[$status_value[node.status]])
entry_status.set_size_request(100, -1)
entry_status.set_xalign(0.5);
entry_status.set_editable false
entry_status.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_status
table_st.attach(label_status,0,1,0,1)
table_st.attach(bbox,1,2,0,1)
frame_st.add table_st
frame_st.show
vbox.add frame_st

frame_dt=Gtk::Frame.new("Details")
frame_dt.border_width=10
table = Gtk::Table.new(8,2,false)
table.show

label_avail = Gtk::Label.new "Availability"
label_avail.show
entry_avail = Gtk::Entry.new
tstyle=Gtk::Style.new
rgb=nil
	rgb=hexa_to_rgb_color($status_color[$status_value.index(node.avail_sev)])
entry_avail.set_text($status[$status_value.index(node.avail_sev)])
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_avail.set_style(tstyle)
entry_avail.set_size_request(100, -1)
entry_avail.set_xalign(0.5);
entry_avail.set_editable false
entry_avail.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_avail
table.attach(label_avail,0,1,0,1)
table.attach(bbox,1,2,0,1)
  
label_service = Gtk::Label.new "Service"
label_service.show
entry_service = Gtk::Entry.new
tstyle=Gtk::Style.new
rgb=nil
if $config.port_mon
 rgb=hexa_to_rgb_color($status_color[$status_value.index(node.service_sev)])
 entry_service.set_text($status[$status_value.index(node.service_sev)])
else
 rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
 entry_service.set_text($status[$status_value.index(UNMANAGED)])
end
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_service.set_style(tstyle)
entry_service.set_size_request(100, -1)
entry_service.set_xalign(0.5);
entry_service.set_editable false
entry_service.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_service
table.attach(label_service,0,1,1,2)
table.attach(bbox,1,2,1,2)

label_snmp = Gtk::Label.new "SNMP"
label_snmp.show
entry_snmp = Gtk::Entry.new
tstyle=Gtk::Style.new
rgb=nil
if $config.snmp_mon
 rgb=hexa_to_rgb_color($status_color[$status_value.index(node.snmp_sev)])
 entry_snmp.set_text($status[$status_value.index(node.snmp_sev)])
	else
 rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
 entry_snmp.set_text($status[$status_value.index(UNMANAGED)])
	end
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_snmp.set_style(tstyle)

entry_snmp.set_size_request(100, -1)
entry_snmp.set_xalign(0.5);
entry_snmp.set_editable false
entry_snmp.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_snmp
table.attach(label_snmp,0,1,2,3)
table.attach(bbox,1,2,2,3)

label_wmi = Gtk::Label.new "WMI"
label_wmi.show
entry_wmi = Gtk::Entry.new
tstyle=Gtk::Style.new
rgb=nil
if $config.wmi_mon
 rgb=hexa_to_rgb_color($status_color[$status_value.index(node.wmi_sev)])
 entry_wmi.set_text($status[$status_value.index(node.wmi_sev)])
	else
 rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
 entry_wmi.set_text($status[$status_value.index(UNMANAGED)])
	end
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_wmi.set_style(tstyle)

entry_wmi.set_size_request(100, -1)
entry_wmi.set_xalign(0.5);
entry_wmi.set_editable false
entry_wmi.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_wmi
table.attach(label_wmi,0,1,3,4)
table.attach(bbox,1,2,3,4)

label_jmx = Gtk::Label.new "JMX"
label_jmx.show
entry_jmx = Gtk::Entry.new
tstyle=Gtk::Style.new
rgb=nil
if $config.jmx_mon
 rgb=hexa_to_rgb_color($status_color[$status_value.index(node.jmx_sev)])
 entry_jmx.set_text($status[$status_value.index(node.jmx_sev)])
	else
 rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
 entry_jmx.set_text($status[$status_value.index(UNMANAGED)])
	end
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_jmx.set_style(tstyle)

entry_jmx.set_size_request(100, -1)
entry_jmx.set_xalign(0.5);
entry_jmx.set_editable false
entry_jmx.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_jmx
table.attach(label_jmx,0,1,4,5)
table.attach(bbox,1,2,4,5)

label_custom = Gtk::Label.new "Custom"
label_custom.show
entry_custom = Gtk::Entry.new
tstyle=Gtk::Style.new
	rgb=nil
	if $config.custom_mon
 rgb=hexa_to_rgb_color($status_color[$status_value.index(node.custom_sev)])
 entry_custom.set_text($status[$status_value.index(node.custom_sev)])
	else
 rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
 entry_custom.set_text($status[$status_value.index(UNMANAGED)])
	end
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_custom.set_style(tstyle)

entry_custom.set_size_request(100, -1)
entry_custom.set_xalign(0.5)
entry_custom.set_editable false
entry_custom.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_custom
table.attach(label_custom,0,1,5,6)
table.attach(bbox,1,2,5,6)

label_syslog = Gtk::Label.new "Syslog"
label_syslog.show
entry_syslog = Gtk::Entry.new
tstyle=Gtk::Style.new
	rgb=nil
	if $config.syslog_mon
 rgb=hexa_to_rgb_color($status_color[$status_value.index(node.syslog_sev)])
 entry_syslog.set_text($status[$status_value.index(node.syslog_sev)])
	else
 rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
 entry_syslog.set_text($status[$status_value.index(UNMANAGED)])
	end
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_syslog.set_style(tstyle)
entry_syslog.set_size_request(100, -1)
entry_syslog.set_xalign(0.5)
entry_syslog.set_editable false
entry_syslog.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_syslog
table.attach(label_syslog,0,1,6,7)
table.attach(bbox,1,2,6,7)

label_trap = Gtk::Label.new "SNMP Trap"
label_trap.show
entry_trap = Gtk::Entry.new
tstyle=Gtk::Style.new
	rgb=nil
	if $config.snmptrap_mon
 rgb=hexa_to_rgb_color($status_color[$status_value.index(node.trap_sev)])
 entry_trap.set_text($status[$status_value.index(node.trap_sev)])
	else
 rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
 entry_trap.set_text($status[$status_value.index(UNMANAGED)])
	end
tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
entry_trap.set_style(tstyle)
entry_trap.set_size_request(100, -1)
entry_trap.set_xalign(0.5)
entry_trap.set_editable false
entry_trap.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_trap
table.attach(label_trap,0,1,7,8)
table.attach(bbox,1,2,7,8)

frame_dt.add table
frame_dt.show
vbox.add frame_dt

#update node sev periodically
refresh_node_sev_display=Thread.new {
	while (window != nil) do
  sleep(10)
  begin
  rgb=hexa_to_rgb_color($status_color[$status_value[node.status]])
  Gtk.thread_protect do
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_status.set_style(tstyle)
  entry_status.set_text($status[$status_value[node.status]])

    rgb=nil
	rgb=hexa_to_rgb_color($status_color[$status_value.index(node.avail_sev)])
	entry_avail.set_text($status[$status_value.index(node.avail_sev)])	
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_avail.set_style(tstyle)
    
    rgb=nil
	if $config.port_mon
	  rgb=hexa_to_rgb_color($status_color[$status_value.index(node.service_sev)])
	  entry_service.set_text($status[$status_value.index(node.service_sev)])	
	else
	   rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
	   entry_service.set_text($status[$status_value.index(UNMANAGED)])
	end
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_service.set_style(tstyle)
	
  rgb=nil
  if $config.snmp_mon || $config.wmi_mon
  	rgb=hexa_to_rgb_color($status_color[$status_value.index(node.snmp_sev)])
  	entry_snmp.set_text($status[$status_value.index(node.snmp_sev)])
  else
  	rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
  	entry_snmp.set_text($status[$status_value.index(UNMANAGED)])
  end
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_snmp.set_style(tstyle)

  rgb=nil
  if $config.wmi_mon
  	rgb=hexa_to_rgb_color($status_color[$status_value.index(node.wmi_sev)])
  	entry_wmi.set_text($status[$status_value.index(node.wmi_sev)])
  else
  	rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
  	entry_wmi.set_text($status[$status_value.index(UNMANAGED)])
  end
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_wmi.set_style(tstyle)      
    
  rgb=nil
  if $config.jmx_mon
  	rgb=hexa_to_rgb_color($status_color[$status_value.index(node.jmx_sev)])
  	entry_jmx.set_text($status[$status_value.index(node.jmx_sev)])
  else
  	rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
  	entry_jmx.set_text($status[$status_value.index(UNMANAGED)])
  end
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_jmx.set_style(tstyle)
    
  rgb=nil
	if $config.custom_mon
  		rgb=hexa_to_rgb_color($status_color[$status_value.index(node.custom_sev)])
 	 	entry_custom.set_text($status[$status_value.index(node.custom_sev)])
	else
	  rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
	  entry_custom.set_text($status[$status_value.index(UNMANAGED)])
	end
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_custom.set_style(tstyle)
    
    rgb=nil
	if $config.syslog_mon
  		rgb=hexa_to_rgb_color($status_color[$status_value.index(node.syslog_sev)])
 	 	entry_syslog.set_text($status[$status_value.index(node.syslog_sev)])
	else
	  rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
	  entry_syslog.set_text($status[$status_value.index(UNMANAGED)])
	end
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_syslog.set_style(tstyle)      

	rgb=nil
	if $config.snmptrap_mon
 		rgb=hexa_to_rgb_color($status_color[$status_value.index(node.trap_sev)])
  		entry_trap.set_text($status[$status_value.index(node.trap_sev)])
	else
	  rgb=hexa_to_rgb_color($status_color[$status_value.index(UNMANAGED)])
	  entry_trap.set_text($status[$status_value.index(UNMANAGED)])
	end
  tstyle=Gtk::Style.new
  tstyle.set_base(Gtk::STATE_NORMAL, rgb.red, rgb.green, rgb.blue)
  entry_trap.set_style(tstyle)
  end
  rescue Exception => msg
	$log.debug("Exception in refresh_node_sev_display for #{node.ip}: #{msg}")
end
	end
}

	hbox = Gtk::HBox.new(FALSE, 1)
	hbox.add Gtk::Image.new(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize::MENU)
	hbox.add Gtk::Label::new("Status")
	hbox.show_all
	notebook.append_page frame, hbox

  window.signal_connect("key_press_event") {|w,e|
  if e.keyval == Gdk::Keyval::GDK_Escape
#we rollback here the account from the db to the @account hash
node.()
Thread.kill(@scan_port_th) unless @scan_port_th == nil
Gtk.thread_flush
Thread.kill(refresh_node_sev_display)
Gtk.thread_flush
window.destroy
  end
}

#########################################################################

#  frame = Gtk::Frame::new
#  frame.border_width=10
#  frame.show

notebook_info = Gtk::Notebook::new()
notebook_info.show

frame_stored = Gtk::Frame::new
frame_stored.border_width=10
frame_stored.set_size_request(300, 290)
frame_stored.show

table = Gtk::Table.new(10,2,false)
table.show

vbox = Gtk::VBox.new
vbox.show
frame_stored.add vbox
vbox.add table

label_icon = Gtk::Label.new "Icon"
label_icon.show
entry_type =  Gtk::ImageComboList.new("type", "#{node.type}")
entry_type.set_size_request(200, -1)
entry_type.show

bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_type

table.attach(label_icon,0,1,0,1)
table.attach(bbox,1,2,0,1)

label_xy = Gtk::Label.new "X:Y"
label_xy.show
entry_x = Gtk::Entry.new
entry_x.set_editable false  
entry_x.set_text "#{node.x.to_i}"
entry_x.set_size_request(96, -1)
entry_x.show
bbox=Gtk::HButtonBox.new
bbox.set_layout_style Gtk::ButtonBox::EDGE
bbox.show
bbox.add entry_x
table.attach(label_xy,0,1,1,2)

entry_y = Gtk::Entry.new
entry_y.set_editable false
entry_y.set_text "#{node.y.to_i}"
entry_y.set_size_request(96, -1)
entry_y.show

bbox.add entry_y

table.attach(bbox,1,2,1,2,Gtk::EXPAND)

label_ip = Gtk::Label.new "IP"
label_ip.show
entry_ip = Gtk::Entry.new
entry_ip.set_editable false
entry_ip.set_text(node.ip)
entry_ip.set_size_request(200, -1)
entry_ip.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_ip

table.attach(label_ip,0,1,2,3)
table.attach(bbox,1,2,2,3)

label_mask = Gtk::Label.new "Mask"
label_mask.show
entry_mask = Gtk::Entry.new
entry_mask.set_text node.netmask.to_s
entry_mask.set_size_request(200, -1)
entry_mask.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_mask

table.attach(label_mask,0,1,3,4)
table.attach(bbox,1,2,3,4)

label_map = Gtk::Label.new "Network"
label_map.show
entry_map = Gtk::Entry.new
entry_map.set_editable false
entry_map.set_text(node.map)
entry_map.set_size_request(200, -1)
entry_map.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_map

table.attach(label_map,0,1,4,5)
table.attach(bbox,1,2,4,5)

label_mac = Gtk::Label.new "MAC"
label_mac.show
entry_mac = Gtk::Entry.new
entry_mac.set_text(node.mac)
entry_mac.set_size_request(200, -1)
entry_mac.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_mac
table.attach(label_mac,0,1,5,6)
table.attach(bbox,1,2,5,6)

label_name = Gtk::Label.new "DNS Name"
label_name.show
entry_name = Gtk::Entry.new
#local host can have name filled by facter and not the dns_name
if node.hostname?() and !node.dns_name?()
   entry_name.set_text(node.name)
else
   entry_name.set_text(node.dns_name)
end
entry_name.set_size_request(200, -1)
entry_name.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_name

table.attach(label_name,0,1,6,7)
table.attach(bbox,1,2,6,7)

label_netbiosname = Gtk::Label.new "Netbios Name"
label_netbiosname.show
entry_netbiosname = Gtk::Entry.new
entry_netbiosname.set_text(node.netbios_name)
entry_netbiosname.set_size_request(200, -1)
entry_netbiosname.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_netbiosname

table.attach(label_netbiosname,0,1,7,8)
table.attach(bbox,1,2,7,8)

label_os = Gtk::Label.new "OS"
label_os.show
entry_os =  Gtk::ImageComboList.new("os", "#{node.os}")
entry_os.set_size_request(200, -1)
entry_os.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_os

table.attach(label_os,0,1,8,9)
table.attach(bbox,1,2,8,9)

label_desc = Gtk::Label.new "Description"
label_desc.show
entry_desc = Gtk::Entry.new
entry_desc.set_text(node.description)
entry_desc.set_size_request(200, -1)
entry_desc.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_desc

table.attach(label_desc,0,1,9,10)
table.attach(bbox,1,2,9,10)

hbox = Gtk::HBox.new(FALSE, 1)
hbox.add Gtk::Image.new(Gtk::Stock::INFO, Gtk::IconSize::MENU)
hbox.add Gtk::Label::new("Information")
hbox.show_all

notebook_info.append_page frame_stored, Gtk::Label::new("Stored")

########## SNMP tab

frame_snmp_info = Gtk::Frame::new
frame_snmp_info.border_width=10
frame_snmp_info.set_size_request(300, 290)
frame_snmp_info.show

table = Gtk::Table.new(5,2,false)
table.show
frame_snmp_info.add table

label_desc = Gtk::Label.new "Description"
label_desc.show
entry_descsnmp = Gtk::Entry.new
entry_descsnmp.set_editable false

def snmp_description(entry, node, read_community)
	if $config.snmp_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_snmp_description(node)
Gtk.thread_protect do
	begin
	   	entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_description for #{node.ip}: #{msg}")
	end
end
 	}
else
Gtk.thread_protect do
		begin
		entry.set_sensitive(false)
	   	entry.set_text "(SNMP is disable)"
	rescue
		$log.debug("Exception in snmp_description for #{node.ip}: #{msg}")		
	end
end
end
end
 if node.("snmp")
	  , password = node.("snmp") 
 snmp_description(entry_descsnmp, node, )
	end
entry_descsnmp.set_size_request(200, -1)
entry_descsnmp.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_descsnmp

table.attach(label_desc,0,1,0,1)
table.attach(bbox,1,2,0,1)

label_uptime = Gtk::Label.new "Uptime"
label_uptime.show
entry_uptime = Gtk::Entry.new
entry_uptime.set_editable false
def snmp_uptime(entry, node, read_community)
if $config.snmp_mon
    entry.set_text "(polling...)"
 Thread.start {
 		val=get_snmp_uptime(node)
Gtk.thread_protect do
	begin
   		entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_uptime for #{node.ip}: #{msg}")			
	end
end
 }
else
begin
	entry.set_sensitive(false)
  		entry.set_text "(SNMP is disable)"
rescue Exception => msg
	$log.debug("Exception in snmp_uptime for #{node.ip}: #{msg}")
end
end
end
if node.("snmp")
	  , password = node.("snmp")
 snmp_uptime(entry_uptime, node, )
end
	entry_uptime.set_size_request(200, -1)
entry_uptime.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_uptime

table.attach(label_uptime,0,1,1,2)
table.attach(bbox,1,2,1,2)

label_contact = Gtk::Label.new "Contact"
label_contact.show
entry_contact = Gtk::Entry.new
entry_contact.set_editable false
def snmp_contact(entry, node, read_community)
if $config.snmp_mon
   entry.set_text "(polling...)"
 Thread.start {
  	val=get_snmp_contact(node)
Gtk.thread_protect do
	begin
  			entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_contact for #{node.ip}: #{msg}")
	end
end
 }
else
	Gtk.thread_protect do
	begin
		entry.set_sensitive(false)
   		entry.set_text "(SNMP is disable)"
	rescue Exception => msg
		$log.debug("Exception in snmp_contact for #{node.ip}: #{msg}")
	end
end

end
end
if node.("snmp")
	  , password = node.("snmp")
 snmp_contact(entry_contact, node, )
	end
entry_contact.set_size_request(200, -1)
entry_contact.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_contact

table.attach(label_contact,0,1,2,3)
table.attach(bbox,1,2,2,3)
label_location = Gtk::Label.new "Location"
label_location.show
entry_location = Gtk::Entry.new
entry_location.set_editable false
def snmp_location(entry, node, read_community)
if $config.snmp_mon
   entry.set_text "(polling...)"
 Thread.start {
  	val=get_snmp_location(node)
Gtk.thread_protect do
	begin
   		entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_location for #{node.ip}: #{msg}")
	end
end
 }
else
Gtk.thread_protect do
		begin
		entry.set_sensitive(false)
	   	entry.set_text "(SNMP is disable)"
	rescue Exception => msg
		$log.debug("Exception in snmp_location for #{node.ip}: #{msg}")
	end
end
end
end
if node.("snmp")
	  , password = node.("snmp")
snmp_location(entry_location, node, )
	end
entry_location.set_size_request(200, -1)
entry_location.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_location

table.attach(label_location,0,1,3,4)
table.attach(bbox,1,2,3,4)

hbbox=Gtk::HButtonBox.new
refresh_button = Gtk::Button.new(Gtk::Stock::REFRESH)
if !$config.snmp_mon
	refresh_button.set_sensitive false
end
hbbox.add refresh_button
hbbox.show

refresh_button.signal_connect("clicked") do
	if node.("snmp")
, password = node.("snmp")
 	snmp_description(entry_descsnmp, node, )
snmp_uptime(entry_uptime, node, )
snmp_contact(entry_contact, node, )
snmp_location(entry_location, node, )
	end
end

refresh_button.show
table.attach(hbbox,1,2,4,5)

notebook_info.append_page frame_snmp_info, Gtk::Label::new("SNMP")

########## WMI tab, info from Win32_ComputerSystem and Win32_OperatingSystem

frame_wmi_info = Gtk::Frame::new
frame_wmi_info.border_width=10
frame_wmi_info.set_size_request(300, 290)
frame_wmi_info.show

table = Gtk::Table.new(8,2,false)
table.show
frame_wmi_info.add table

label_desc = Gtk::Label.new "Description"
label_desc.show
entry_descwmi = Gtk::Entry.new
entry_descwmi.set_editable false

def wmi_description(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_description(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
			   	entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_description for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end
if node.("wmi")
	  , password = node.("wmi")
 wmi_description(entry_descwmi, node, , password)
end
entry_descwmi.set_size_request(200, -1)
entry_descwmi.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_descwmi

table.attach(label_desc,0,1,0,1)
table.attach(bbox,1,2,0,1)

label_boot = Gtk::Label.new "Bootup State"
label_boot.show
entry_bootwmi = Gtk::Entry.new
entry_bootwmi.set_editable false

def wmi_boot(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_boot_state(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
				entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_boot for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	Gtk.thread_protect do
 	begin
		entry.set_sensitive(false)
		entry.set_text "(WMI is disable)"
	rescue
	end
end
end
end

if node.("wmi")
	  , password = node.("wmi")
 wmi_boot(entry_bootwmi, node, , password)
end
entry_bootwmi.set_size_request(200, -1)
entry_bootwmi.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_bootwmi

table.attach(label_boot,0,1,1,2)
table.attach(bbox,1,2,1,2)

label_thermal = Gtk::Label.new "Thermal State"
label_thermal.show
entry_thermalwmi = Gtk::Entry.new
entry_thermalwmi.set_editable false

def wmi_thermal(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_thermal_state(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
		   		entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_thermal for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

if node.("wmi")
	  , password = node.("wmi")
 wmi_thermal(entry_thermalwmi, node, , password)
end
entry_thermalwmi.set_size_request(200, -1)
entry_thermalwmi.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_thermalwmi

table.attach(label_thermal,0,1,2,3)
table.attach(bbox,1,2,2,3)

label_nbproc = Gtk::Label.new "Processor Number"
label_nbproc.show
entry_nbprocwmi = Gtk::Entry.new
entry_nbprocwmi.set_editable false

def wmi_nbproc(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_nb_proc(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
			   	entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_nbproc for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

if node.("wmi")
	  , password = node.("wmi")
 wmi_nbproc(entry_nbprocwmi, node, , password)
end
entry_nbprocwmi.set_size_request(200, -1)
entry_nbprocwmi.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_nbprocwmi

table.attach(label_nbproc,0,1,3,4)
table.attach(bbox,1,2,3,4)

label_systype = Gtk::Label.new "System Type"
label_systype.show
entry_systype = Gtk::Entry.new
entry_systype.set_editable false

def wmi_systype(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_system_type(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
			   	entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_systype for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

if node.("wmi")
	  , password = node.("wmi")
 wmi_systype(entry_systype, node, , password)
end
entry_systype.set_size_request(200, -1)
entry_systype.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_systype

table.attach(label_systype,0,1,4,5)
table.attach(bbox,1,2,4,5)

label_oswmi = Gtk::Label.new "OS"
label_oswmi.show
entry_oswmi = Gtk::Entry.new
entry_oswmi.set_editable false

def wmi_os(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_os(, pass, node.ip)
if val
	Gtk.thread_protect do
		begin
		   	entry.set_position 0
			entry.set_text val
		rescue Exception => msg
			$log.debug("Exception in wmi_os for #{node.ip}: #{msg}")
		end
	end
end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

if node.("wmi")
	  , password = node.("wmi")
 wmi_os(entry_oswmi, node, , password)
end
entry_oswmi.set_size_request(200, -1)
entry_oswmi.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_oswmi

table.attach(label_oswmi,0,1,5,6)
table.attach(bbox,1,2,5,6)

label_producttype = Gtk::Label.new "Product Type"
label_producttype.show
entry_producttype = Gtk::Entry.new
entry_producttype.set_editable false

def wmi_producttype(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_product_type(, pass, node.ip)
if val
	Gtk.thread_protect do
		begin
		   	entry.set_position 0
			entry.set_text val
		rescue Exception => msg
			$log.debug("Exception in wmi_producttype for #{node.ip}: #{msg}")
		end
	end
end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

if node.("wmi")
	  , password = node.("wmi")
 wmi_producttype(entry_producttype, node, , password)
end
entry_producttype.set_size_request(200, -1)
entry_producttype.show
bbox=Gtk::HButtonBox.new
bbox.show
bbox.add entry_producttype

table.attach(label_producttype,0,1,6,7)
table.attach(bbox,1,2,6,7)

hbbox=Gtk::HButtonBox.new
refresh_button_wmi = Gtk::Button.new(Gtk::Stock::REFRESH)
if !$config.wmi_mon
	refresh_button_wmi.set_sensitive false
end
hbbox.add refresh_button_wmi
hbbox.show

refresh_button_wmi.signal_connect("clicked") do
	if node.("wmi")
, password = node.("wmi")
wmi_description(entry_descwmi, node, , password)
 	wmi_boot(entry_bootwmi, node, , password)
 	wmi_thermal(entry_thermalwmi, node, , password)
 	wmi_nbproc(entry_nbprocwmi, node, , password)
wmi_systype(entry_systype, node, , password)		
wmi_os(entry_oswmi, node, , password)
wmi_producttype(entry_producttype, node, , password)
	end
end

refresh_button_wmi.show
table.attach(hbbox,1,2,7,8)


notebook_info.append_page frame_wmi_info, Gtk::Label::new("WMI")

notebook.append_page notebook_info, hbox

###############################Account conf########################

eval IO.read("#{GNMSLIB}"+'/gui/sub/account_frame.rb')

########### begin port monitoring #################################

frame = Gtk::Frame::new
frame.border_width=10
frame.show

vvbox = Gtk::VBox::new
vvbox.show
vvbox.add frame

vbox = Gtk::VBox::new(false,3)
vbox.show
frame.add vbox  

@vbox_ports = Gtk::VBox::new
@vbox_ports.show

#scrolled_window.add_with_viewport(vbox_ports)
#vbox_ports.set_focus_vadjustment(scrolled_window.vadjustment)
#scrolled_window.show
vbox.add @vbox_ports
@scan_port_th=nil
@cbutton=[]
@scanned_port_list=nil

######################## nmap thread ##################################

 ls = Gtk::ListStore.new(Integer, String, Integer, String, String)
 @treeview = Gtk::TreeView.new(ls)

 renderer = Gtk::CellRendererToggle.new
 renderer.signal_connect('toggled') do |cell, path|
 # get toggled iter
 iter = @treeview.model.get_iter(path)
 fixed =iter[0]
 # do something with the value
 fixed ^= 1
 @cbutton[path.to_i()]=fixed
 # set new value
 iter[0] = fixed
 end

	column1 = Gtk::TreeViewColumn.new("Enabled",
			 renderer, {:active => 0})
	column1.set_clickable(true)
	column2 = Gtk::TreeViewColumn.new("Protocol",
			 Gtk::CellRendererText.new, {:text => 1})
	column2.set_sort_column_id(1)
	column3 = Gtk::TreeViewColumn.new("Port",
			 Gtk::CellRendererText.new, {:text => 2})
	column3.set_sort_column_id(2)
	column4 = Gtk::TreeViewColumn.new("Service",
			 Gtk::CellRendererText.new, {:text => 3})
	column4.set_sort_column_id(3)
	sev_renderer = Gtk::CellRendererText.new
      column5 = Gtk::TreeViewColumn.new("Severity", sev_renderer, {:text => 4})
      column5.set_sort_column_id(4)
	
	column5.set_cell_data_func(sev_renderer) do |col, renderer, model, iter|
 if iter[4] and iter[4] != ""
   renderer.set_background_gdk(@color_style[$status.index(iter[4])])
 else
   renderer.background = nil
 end
      end
	
	column1.signal_connect("clicked") do |column|
toggle_select_port()
	end  

	@treeview.append_column(column1)
	@treeview.append_column(column2)
	@treeview.append_column(column3)
	@treeview.append_column(column4)
	@treeview.append_column(column5)
	@treeview.show

	# Create a menu
	menu_port = Gtk::Menu.new

	item_add_serv = Gtk::ImageMenuItem.new("Add service")
image_item_add_serv = Gtk::Image.new() 
image_item_add_serv.set_stock(Gtk::Stock::ADD) 
	item_add_serv.set_image(image_item_add_serv)
	item_add_serv.signal_connect("activate") { add_monitored_service() }
	menu_port.append(item_add_serv)

	item_del_serv = Gtk::ImageMenuItem.new("Delete selected service")
image_item_del_serv = Gtk::Image.new() 
image_item_del_serv.set_stock(Gtk::Stock::REMOVE) 
	item_del_serv.set_image(image_item_del_serv)
	item_del_serv.signal_connect("activate") {
@treeview.model.remove(@treeview.selection.selected) unless @treeview.selection.selected==nil
	}
	menu_port.append(item_del_serv)

	item_edit_serv = Gtk::ImageMenuItem.new("Edit service")
image_item_edit_serv = Gtk::Image.new() 
image_item_edit_serv.set_stock(Gtk::Stock::EDIT) 
	item_edit_serv.set_image(image_item_edit_serv)
	item_edit_serv.signal_connect("activate") { edit_monitored_service() }
	menu_port.append(item_edit_serv)

	scan_port_serv = Gtk::ImageMenuItem.new("Test service")
image_scan_port_serv = Gtk::Image.new() 
image_scan_port_serv.set_stock(Gtk::Stock::DIALOG_QUESTION) 
	scan_port_serv.set_image(image_scan_port_serv)
	scan_port_serv.signal_connect("activate") { scan_port_now(node) }
	menu_port.append(scan_port_serv)

	scan_ports_serv = Gtk::ImageMenuItem.new("Scan all ports")
image_scan_ports_serv = Gtk::Image.new() 
image_scan_ports_serv.set_stock(Gtk::Stock::REFRESH) 
	scan_ports_serv.set_image(image_scan_ports_serv)
	scan_ports_serv.signal_connect("activate") { scan_ports_now(node) }
	menu_port.append(scan_ports_serv)

	item_sw_serv = Gtk::MenuItem.new("Switch selection")
	item_sw_serv.signal_connect("activate") { toggle_select_port() }
	menu_port.append(item_sw_serv)
	menu_port.show_all

      @treeview.signal_connect("key_press_event") do |tview,e|
  if e.keyval == Gdk::Keyval::GDK_Delete
     tview.model.remove(tview.selection.selected) unless tview.selection.selected==nil
  end
	end

	@treeview.signal_connect("button_press_event") do |widget, event|
 if event.kind_of? Gdk::EventButton and event.button == 3
 if @treeview.selection.selected==nil 
	 item_edit_serv.set_sensitive(false)
	 item_del_serv.set_sensitive(false)
	 scan_port_serv.set_sensitive(false)
 else
	 item_edit_serv.set_sensitive(true)
	 item_del_serv.set_sensitive(true)
	 scan_port_serv.set_sensitive(true)
 end
 if $config.nmap_vers.to_f() == 0.0
   scan_ports_serv.set_sensitive(false)
 else
   scan_ports_serv.set_sensitive(true)
 end
 	 menu_port.popup(nil, nil, event.button, event.time)
 elsif (@treeview.selection.selected!=nil) && (event.event_type == Gdk::Event::BUTTON2_PRESS)
edit_monitored_service()	
 end
	end

fill_port_list(node)
fill_port_view(node)

if !$config.port_mon
@treeview.set_sensitive false
@treeview.show
frame.set_label("This monitoring is disabled")
end

notebook_inside = Gtk::Notebook::new()
label_port = Gtk::Label::new("Service")
notebook_inside.append_page(vvbox, label_port)
notebook_inside.show

######################### snmp oid monitoring ###################################################################

frame = Gtk::Frame::new
frame.border_width=10
frame.set_size_request(300, 290)
frame.show

vbox = Gtk::VBox::new
vbox.show
frame.add vbox

snmp_ls = Gtk::ListStore.new(Integer, String, String, String, String)
@snmpview = Gtk::TreeView.new(snmp_ls)

 renderer_snmp = Gtk::CellRendererToggle.new
 renderer_snmp.signal_connect('toggled') do |cell, path|
 # get toggled iter
 iter = @snmpview.model.get_iter(path)
 fixed =iter[0]
 # do something with the value
 fixed ^= 1
 # set new value
 iter[0] = fixed
 end

if !$config.snmp_mon
@snmpview.set_sensitive false
frame.set_label("This monitoring is disabled")
end

if OIDRef::oid_ref_nb_entry() == 0
	 @snmpview.set_sensitive false
frame.set_label("No SNMP OID defined, go in Tools menu")
end

column1 = Gtk::TreeViewColumn.new("Enabled",
			renderer_snmp, {:active => 0})
column1.set_clickable(true)
column2 = Gtk::TreeViewColumn.new("OID label",
			Gtk::CellRendererText.new, {:text => 1})
column2.set_sort_column_id(1)
column3 = Gtk::TreeViewColumn.new("Operator",
			Gtk::CellRendererText.new, {:text => 2})
column3.set_sort_column_id(2)
tr=Gtk::CellRendererText.new
tr.mode=Gtk::CellRenderer::MODE_EDITABLE
column4 = Gtk::TreeViewColumn.new("Threshold",
			tr, {:text => 3})
column4.set_sort_column_id(3)
sev_renderer = Gtk::CellRendererText.new
column5 = Gtk::TreeViewColumn.new("Severity",	sev_renderer, {:text => 4})
column5.set_sort_column_id(4)

column5.set_cell_data_func(sev_renderer) do |col, renderer, model, iter|
  if iter[4] and iter[4] != ""
    renderer.set_background_gdk(@color_style[$status.index(iter[4])])
  else
    renderer.background = nil
  end
end

@snmpview.append_column(column1)
@snmpview.append_column(column2)
@snmpview.append_column(column3)
@snmpview.append_column(column4)
@snmpview.append_column(column5)
@snmpview.show

	# Create a menu
	menu_snmp = Gtk::Menu.new

	item_add_snmp = Gtk::ImageMenuItem.new("Add SNMP Ref")
image_item_add_snmp = Gtk::Image.new() 
image_item_add_snmp.set_stock(Gtk::Stock::ADD) 
	item_add_snmp.set_image(image_item_add_snmp)
	item_add_snmp.signal_connect("activate") { add_monitored_snmp() unless OIDRef::get_oid_refs_name().size() == 0 }
	menu_snmp.append(item_add_snmp)

	item_del_snmp = Gtk::ImageMenuItem.new("Delete selected SNMP Ref")
image_item_del_snmp = Gtk::Image.new() 
image_item_del_snmp.set_stock(Gtk::Stock::REMOVE) 
	item_del_snmp.set_image(image_item_del_snmp)
	item_del_snmp.signal_connect("activate") {
@snmpview.model.remove(@snmpview.selection.selected) unless @snmpview.selection.selected==nil
	}
	menu_snmp.append(item_del_snmp)

	item_edit_snmp = Gtk::ImageMenuItem.new("Edit SNMP Ref")
image_edit_snmp = Gtk::Image.new() 
image_edit_snmp.set_stock(Gtk::Stock::EDIT) 
	item_edit_snmp.set_image(image_edit_snmp)
	item_edit_snmp.signal_connect("activate") { edit_monitored_snmp() }
	menu_snmp.append(item_edit_snmp)

	menu_snmp.show_all

	@snmpview.signal_connect("button_press_event") do |widget, event|
 if event.kind_of? Gdk::EventButton and event.button == 3
if @snmpview.selection.selected==nil 
	item_edit_snmp.set_sensitive(false)
	item_del_snmp.set_sensitive(false)
else
	item_edit_snmp.set_sensitive(true)
	item_del_snmp.set_sensitive(true)
end
if OIDRef::get_oid_refs_name().size() > 0
	item_add_snmp.set_sensitive(true)
else
	item_add_snmp.set_sensitive(false)
end
 	menu_snmp.popup(nil, nil, event.button, event.time)
 elsif (@snmpview.selection.selected!=nil) && (event.event_type == Gdk::Event::BUTTON2_PRESS)
edit_monitored_snmp()	
 end
	end

	#populate with saved values
 node.snmp_monitoring.each_value do |snmp_mon|
 iter = snmp_ls.append
 iter[0] = snmp_mon.get_state()
 iter[1] = snmp_mon.oidref
 iter[2] = snmp_mon.oper
 iter[3] = snmp_mon.threshold.to_s
 iter[4] = snmp_mon.severity
	end

	vbox.add(@snmpview)

label_snmp = Gtk::Label::new("SNMP")
notebook_inside.append_page frame, label_snmp

######################### end snmp oid monitoring ##########################################################

######################### wmi monitoring ###################################################################

frame = Gtk::Frame::new
frame.border_width=10
frame.set_size_request(300, 290)
frame.show

vbox = Gtk::VBox::new
vbox.show
frame.add vbox

wmi_ls = Gtk::ListStore.new(Integer, String, String, String, String)
@wmiview = Gtk::TreeView.new(wmi_ls)

 renderer_wmi = Gtk::CellRendererToggle.new
 renderer_wmi.signal_connect('toggled') do |cell, path|
 # get toggled iter
 iter = @wmiview.model.get_iter(path)
 fixed =iter[0]
 # do something with the value
 fixed ^= 1
 # set new value
 iter[0] = fixed
 end

if !$config.wmi_mon
@wmiview.set_sensitive false
frame.set_label("This monitoring is disabled")
end

if WMIRef::wmi_ref_nb_entry() == 0
	 @wmiview.set_sensitive false
frame.set_label("No WMI request defined, go in Tools menu")
end

column1 = Gtk::TreeViewColumn.new("Enabled",
			renderer_wmi, {:active => 0})
column1.set_clickable(true)
column2 = Gtk::TreeViewColumn.new("WMI label",
			Gtk::CellRendererText.new, {:text => 1})
column2.set_sort_column_id(1)
column3 = Gtk::TreeViewColumn.new("Operator",
			Gtk::CellRendererText.new, {:text => 2})
column3.set_sort_column_id(2)
tr=Gtk::CellRendererText.new
tr.mode=Gtk::CellRenderer::MODE_EDITABLE
column4 = Gtk::TreeViewColumn.new("Threshold",
			tr, {:text => 3})
column4.set_sort_column_id(3)
sev_renderer = Gtk::CellRendererText.new
column5 = Gtk::TreeViewColumn.new("Severity", sev_renderer, {:text => 4})
column5.set_sort_column_id(4)

column5.set_cell_data_func(sev_renderer) do |col, renderer, model, iter|
  if iter[4] and iter[4] != ""
    renderer.set_background_gdk(@color_style[$status.index(iter[4])])
  else
    renderer.background = nil
  end
end

@wmiview.append_column(column1)
@wmiview.append_column(column2)
@wmiview.append_column(column3)
@wmiview.append_column(column4)
@wmiview.append_column(column5)
@wmiview.show

	# Create a popup menu
	menu_wmi = Gtk::Menu.new

	item_add_wmi = Gtk::ImageMenuItem.new("Add WMI Ref")
image_item_add_wmi = Gtk::Image.new()
image_item_add_wmi.set_stock(Gtk::Stock::ADD)
	item_add_wmi.set_image(image_item_add_wmi)
	item_add_wmi.signal_connect("activate") { add_monitored_wmi() unless WMIRef::get_wmi_refs_name().size() == 0 }
	menu_wmi.append(item_add_wmi)

	item_del_wmi = Gtk::ImageMenuItem.new("Delete selected WMI Ref")
image_item_del_wmi = Gtk::Image.new() 
image_item_del_wmi.set_stock(Gtk::Stock::REMOVE) 
	item_del_wmi.set_image(image_item_del_wmi)
	item_del_wmi.signal_connect("activate") {
@wmiview.model.remove(@wmiview.selection.selected) unless @wmiview.selection.selected==nil
	}
	menu_wmi.append(item_del_wmi)

	item_edit_wmi = Gtk::ImageMenuItem.new("Edit WMI Ref")
image_edit_wmi = Gtk::Image.new() 
image_edit_wmi.set_stock(Gtk::Stock::EDIT) 
	item_edit_wmi.set_image(image_edit_wmi)
	item_edit_wmi.signal_connect("activate") { edit_monitored_wmi() }
	menu_wmi.append(item_edit_wmi)

	menu_wmi.show_all

	@wmiview.signal_connect("button_press_event") do |widget, event|
 if event.kind_of? Gdk::EventButton and event.button == 3
if @wmiview.selection.selected==nil 
	item_edit_wmi.set_sensitive(false)
	item_del_wmi.set_sensitive(false)
else
	item_edit_wmi.set_sensitive(true)
	item_del_wmi.set_sensitive(true)
end
if WMIRef::get_wmi_refs_name().size() > 0
	item_add_wmi.set_sensitive(true)
else
	item_add_wmi.set_sensitive(false)
end
 	menu_wmi.popup(nil, nil, event.button, event.time)
 elsif (@wmiview.selection.selected!=nil) && (event.event_type == Gdk::Event::BUTTON2_PRESS)
edit_monitored_wmi()	
 end
	end

	#populate with saved values
 node.wmi_monitoring.each_value do |wmi_mon|
 iter = wmi_ls.append
 iter[0] = wmi_mon.get_state()
 iter[1] = wmi_mon.wmiref
 iter[2] = wmi_mon.oper
 iter[3] = wmi_mon.value.to_s
 iter[4] = wmi_mon.severity
	end

	vbox.add(@wmiview)

label_wmi = Gtk::Label::new("WMI")
notebook_inside.append_page frame, label_wmi

###########################end wmi monitoring#####################################################################

######################### jmx monitoring ###################################################################

frame = Gtk::Frame::new
frame.border_width=10
frame.set_size_request(300, 290)
frame.show

vbox = Gtk::VBox::new
vbox.show
frame.add vbox

jmx_ls = Gtk::ListStore.new(Integer, String, String, String)
@jmxview = Gtk::TreeView.new(jmx_ls)

 renderer_jmx = Gtk::CellRendererToggle.new
 renderer_jmx.signal_connect('toggled') do |cell, path|
 # get toggled iter
 iter = @jmxview.model.get_iter(path)
 fixed =iter[0]
 # do something with the value
 fixed ^= 1
 # set new value
 iter[0] = fixed
 node.jmx_monitoring[iter[1]].set_state(fixed.to_i)
 end

if !$config.jmx_mon
@jmxview.set_sensitive false
frame.set_label("This monitoring is disabled")
end

if JMXRef::jmx_ref_nb_entry() == 0
	 @jmxview.set_sensitive false
frame.set_label("No jmx request defined, go in Tools menu")
end

column1 = Gtk::TreeViewColumn.new("Enabled",
			renderer_jmx, {:active => 0})
column1.set_clickable(true)
column2 = Gtk::TreeViewColumn.new("Label",
			Gtk::CellRendererText.new, {:text => 1})
column2.set_sort_column_id(1)
column3 = Gtk::TreeViewColumn.new("Protocol/Port",
			Gtk::CellRendererText.new, {:text => 2})
column3.set_sort_column_id(2)
column4 = Gtk::TreeViewColumn.new("Auth",
			Gtk::CellRendererText.new, {:text => 3})
column4.set_sort_column_id(3)

@jmxview.append_column(column1)
@jmxview.append_column(column2)
@jmxview.append_column(column3)
@jmxview.append_column(column4)
@jmxview.show

	# Create a popup menu
	menu_jmx = Gtk::Menu.new

	item_add_jmx = Gtk::ImageMenuItem.new("Add JMX Ref")
image_item_add_jmx = Gtk::Image.new()
image_item_add_jmx.set_stock(Gtk::Stock::ADD)
	item_add_jmx.set_image(image_item_add_jmx)
	item_add_jmx.signal_connect("activate") { add_monitored_jmx(node) unless JMXRef::get_jmx_refs_name().size() == 0 }
	menu_jmx.append(item_add_jmx)

	item_del_jmx = Gtk::ImageMenuItem.new("Delete selected JMX Ref")
image_item_del_jmx = Gtk::Image.new() 
image_item_del_jmx.set_stock(Gtk::Stock::REMOVE) 
	item_del_jmx.set_image(image_item_del_jmx)
	item_del_jmx.signal_connect("activate") {
@jmxview.model.remove(@jmxview.selection.selected) unless @jmxview.selection.selected==nil
	}
	menu_jmx.append(item_del_jmx)

	item_edit_jmx = Gtk::ImageMenuItem.new("Edit JMX Ref")
image_edit_jmx = Gtk::Image.new() 
image_edit_jmx.set_stock(Gtk::Stock::EDIT) 
	item_edit_jmx.set_image(image_edit_jmx)
	item_edit_jmx.signal_connect("activate") { edit_monitored_jmx(node) }
	menu_jmx.append(item_edit_jmx)

	menu_jmx.show_all

	@jmxview.signal_connect("button_press_event") do |widget, event|
 if event.kind_of? Gdk::EventButton and event.button == 3
if @jmxview.selection.selected==nil 
	item_edit_jmx.set_sensitive(false)
	item_del_jmx.set_sensitive(false)
else
	item_edit_jmx.set_sensitive(true)
	item_del_jmx.set_sensitive(true)
end
if JMXRef::get_jmx_refs_name().size() > 0
	item_add_jmx.set_sensitive(true)
else
	item_add_jmx.set_sensitive(false)
end
 	menu_jmx.popup(nil, nil, event.button, event.time)
 elsif (@jmxview.selection.selected!=nil) && (event.event_type == Gdk::Event::BUTTON2_PRESS)
edit_monitored_jmx(node)	
 end
	end

	#populate with saved values
 node.jmx_monitoring.each_value do |jmx_mon|
 iter = jmx_ls.append
 iter[0] = jmx_mon.get_state()
 iter[1] = jmx_mon.get_ref()
 iter[2] = "#{jmx_mon.get_protocol()}/#{jmx_mon.get_port()}"
 iter[3] = jmx_mon.get_auth()
	end

	vbox.add(@jmxview)

label_jmx = Gtk::Label::new("JMX")
notebook_inside.append_page frame, label_jmx

###########################end jmx monitoring#####################################################################

######################### snmp trap monitoring ###################################################################

frame = Gtk::Frame::new
frame.border_width=10
frame.set_size_request(300, 290)
frame.show

vbox = Gtk::VBox::new
vbox.show
frame.add vbox

snmp_trap_ls = Gtk::ListStore.new(Integer, String, String, String)
@snmptrapview = Gtk::TreeView.new(snmp_trap_ls)
@snmptrapview.set_tooltip_column(3)  

 renderer_snmp = Gtk::CellRendererToggle.new
 renderer_snmp.signal_connect('toggled') do |cell, path|
 # get toggled iter
 iter = @snmptrapview.model.get_iter(path)
 fixed =iter[0]
 # do something with the value
 fixed ^= 1
 # set new value
 iter[0] = fixed
 end

if !$config.snmptrap_mon
 @snmptrapview.set_sensitive false
frame.set_label("This monitoring is disabled")
end

column1 = Gtk::TreeViewColumn.new("Enabled",
			renderer_snmp, {:active => 0})
column1.set_clickable(true)
column2 = Gtk::TreeViewColumn.new("Trap label",
			Gtk::CellRendererText.new, {:text => 1})
column2.set_sort_column_id(1)
sev_renderer = Gtk::CellRendererText.new
column3 = Gtk::TreeViewColumn.new("Severity",	sev_renderer, {:text => 2})
column4 = Gtk::TreeViewColumn.new("Description",
			Gtk::CellRendererText.new, {:text => 3})          
column4.visible = false
column3.set_cell_data_func(sev_renderer) do |col, renderer, model, iter|
  if iter[2] and iter[2] != ""
    renderer.set_background_gdk(@color_style[$status.index(iter[2])])
  else
    renderer.background = nil
  end
end

@snmptrapview.append_column(column1)
@snmptrapview.append_column(column2)
@snmptrapview.append_column(column3)
@snmptrapview.append_column(column4)
@snmptrapview.show

	# Create a menu
	menu_snmptrap = Gtk::Menu.new
	item_add_snmptrap = Gtk::ImageMenuItem.new("Add SNMP Trap")
image_item_add_snmptrap = Gtk::Image.new() 
image_item_add_snmptrap.set_stock(Gtk::Stock::ADD) 
	item_add_snmptrap.set_image(image_item_add_snmptrap)
	item_add_snmptrap.signal_connect("activate") { add_monitored_snmptrap() unless SnmpTrapRef::get_snmptrap_refs_name().size() == 0 }
	menu_snmptrap.append(item_add_snmptrap)

	item_del_snmptrap = Gtk::ImageMenuItem.new("Delete selected SNMP Trap")
image_item_del_snmptrap = Gtk::Image.new() 
image_item_del_snmp.set_stock(Gtk::Stock::REMOVE) 
	item_del_snmptrap.set_image(image_item_del_snmptrap)
	item_del_snmptrap.signal_connect("activate") {
@snmptrapview.model.remove(@snmptrapview.selection.selected) unless @snmptrapview.selection.selected==nil
	}
	menu_snmptrap.append(item_del_snmptrap)

	item_edit_snmptrap = Gtk::ImageMenuItem.new("Edit SNMP Trap")
image_edit_snmptrap = Gtk::Image.new() 
image_edit_snmptrap.set_stock(Gtk::Stock::EDIT) 
	item_edit_snmptrap.set_image(image_edit_snmptrap)
	item_edit_snmptrap.signal_connect("activate") { edit_monitored_snmp() }
	menu_snmptrap.append(item_edit_snmptrap)

	menu_snmptrap.show_all

	@snmptrapview.signal_connect("button_press_event") do |widget, event|
 if event.kind_of? Gdk::EventButton and event.button == 3
if @snmptrapview.selection.selected==nil 
	item_edit_snmptrap.set_sensitive(false)
	item_del_snmptrap.set_sensitive(false)
else
	item_edit_snmptrap.set_sensitive(true)
	item_del_snmptrap.set_sensitive(true)
end
if SnmpTrapRef::get_snmptrap_refs_name().size() > 0 && get_snmptrap_refs_left().size() > 0
	item_add_snmptrap.set_sensitive(true)
else
	item_add_snmptrap.set_sensitive(false)
end
 	menu_snmptrap.popup(nil, nil, event.button, event.time)
 elsif (@snmptrapview.selection.selected!=nil) && (event.event_type == Gdk::Event::BUTTON2_PRESS)
edit_monitored_snmptrap()	
 end
	end

	#populate with saved values
 node.snmptrap_monitoring.each_value do |snmptrap_mon|
 iter = snmp_trap_ls.append
 iter[0] = snmptrap_mon.get_state()
 iter[1] = snmptrap_mon.get_snmptrap_ref()
 iter[2] = snmptrap_mon.severity()
        iter[3] = $snmptrap_refs[snmptrap_mon.get_snmptrap_ref()].description
	end

	vbox.add(@snmptrapview)

label_snmptrap = Gtk::Label::new("SNMP trap")
notebook_inside.append_page frame, label_snmptrap

###########################end snmp trap monitoring############################################################

######################### syslog monitoring ###################################################################

frame = Gtk::Frame::new
frame.border_width=10
frame.set_size_request(300, 290)
frame.show

vbox = Gtk::VBox::new
vbox.show
frame.add vbox

syslog_ls = Gtk::ListStore.new(Integer, String, String, String)
@syslogview = Gtk::TreeView.new(syslog_ls)
@syslogview.set_tooltip_column(3)  

 renderer_syslog = Gtk::CellRendererToggle.new
 renderer_syslog.signal_connect('toggled') do |cell, path|
 # get toggled iter
 iter = @syslogview.model.get_iter(path)
 fixed =iter[0]
 # do something with the value
 fixed ^= 1
 # set new value
 iter[0] = fixed
 end

if !$config.syslog_mon
 @syslogview.set_sensitive false
frame.set_label("This monitoring is disabled")
end

column1 = Gtk::TreeViewColumn.new("Enabled",
			renderer_syslog, {:active => 0})
column1.set_clickable(true)
column2 = Gtk::TreeViewColumn.new("Syslog label",
			Gtk::CellRendererText.new, {:text => 1})
column2.set_sort_column_id(1)
sev_renderer = Gtk::CellRendererText.new  
column3 = Gtk::TreeViewColumn.new("Severity",	sev_renderer, {:text => 2})
column4 = Gtk::TreeViewColumn.new("Description", Gtk::CellRendererText.new, {:text => 3})
column4.visible = false
column3.set_cell_data_func(sev_renderer) do |col, renderer, model, iter|
  if iter[2] and iter[2] != ""
    ind = $status.index(iter[2])
    if ind
      color = @color_style[ind]
      if color
        renderer.set_background_gdk(color)
      end
      next
    end
  end
  renderer.background = nil
end

@syslogview.append_column(column1)
@syslogview.append_column(column2)
@syslogview.append_column(column3)
@syslogview.append_column(column4)
@syslogview.show

	# Create a menu
	menu_syslog = Gtk::Menu.new

	item_add_syslog = Gtk::ImageMenuItem.new("Add Syslog Ref")
image_item_add_syslog = Gtk::Image.new() 
image_item_add_syslog.set_stock(Gtk::Stock::ADD) 
	item_add_syslog.set_image(image_item_add_syslog)
	item_add_syslog.signal_connect("activate") {	
add_monitored_syslog() unless SyslogRef::get_syslog_refs_name().size() == 0
}
	
	menu_syslog.append(item_add_syslog)

	item_del_syslog = Gtk::ImageMenuItem.new("Delete selected Syslog Ref")
image_item_del_syslog = Gtk::Image.new() 
image_item_del_syslog.set_stock(Gtk::Stock::REMOVE) 
	item_del_syslog.set_image(image_item_del_syslog)
	item_del_syslog.signal_connect("activate") {
@syslogview.model.remove(@syslogview.selection.selected) unless @syslogview.selection.selected==nil
	}
	menu_syslog.append(item_del_syslog)

	item_edit_syslog = Gtk::ImageMenuItem.new("Edit Syslog Ref")
	image_item_edit_syslog = Gtk::Image.new() 
	image_item_edit_syslog.set_stock(Gtk::Stock::EDIT) 
	item_edit_syslog.set_image(image_item_edit_syslog)
	item_edit_syslog.signal_connect("activate") { edit_monitored_syslog() }
	menu_syslog.append(item_edit_syslog)

	menu_syslog.show_all

	@syslogview.signal_connect("button_press_event") do |widget, event|
 if event.kind_of? Gdk::EventButton and event.button == 3
 if @syslogview.selection.selected==nil 
	 item_edit_syslog.set_sensitive(false)
	 item_del_syslog.set_sensitive(false)
 else
	 item_edit_syslog.set_sensitive(true)
	 item_del_syslog.set_sensitive(true)
 end
if SyslogRef::get_syslog_refs_name().size() > 0 && get_syslog_refs_left().size() > 0
	item_add_syslog.set_sensitive(true)
else
	item_add_syslog.set_sensitive(false)
end
 	 menu_syslog.popup(nil, nil, event.button, event.time)
 elsif (@syslogview.selection.selected!=nil) && (event.event_type == Gdk::Event::BUTTON2_PRESS)
edit_monitored_syslog()	
 end
	end

	#populate with saved values
 node.syslog_monitoring.each_value do |syslog_mon|
 iter = syslog_ls.append
 iter[0] = syslog_mon.get_state()
 iter[1] = syslog_mon.get_syslog_ref()
	if syslog_mon.raw_severity()>0
 iter[2] = syslog_mon.severity()
	else
 iter[2] = MAP_SYSLOG_SEV
	end
 iter[3] = $syslog_refs[syslog_mon.get_syslog_ref()].description
	end

	vbox.add(@syslogview)

label_syslog = Gtk::Label::new("Syslog")
notebook_inside.append_page frame, label_syslog

###########################end syslog monitoring#################################################################

######################### external cmd/plugin monitoring ###################################################################

frame = Gtk::Frame::new
frame.border_width=10
frame.set_size_request(300, 290)
frame.show

vbox = Gtk::VBox::new
vbox.show
frame.add vbox 

custom_ls = Gtk::ListStore.new(Integer, String, String, String, String)
@customview = Gtk::TreeView.new(custom_ls)
@customview.set_tooltip_column(4)

if !$config.custom_mon
@customview.set_sensitive false
frame.set_label("This monitoring is disabled")
end

renderer = Gtk::CellRendererToggle.new
renderer.signal_connect('toggled') do |cell, path|
# get toggled iter
iter = @customview.model.get_iter(path)
fixed =iter[0]
# do something with the value
fixed ^= 1
# set new value
iter[0] = fixed
end

column1 = Gtk::TreeViewColumn.new("Enabled",
			renderer, {:active => 0})
column1.set_clickable(true)
column2 = Gtk::TreeViewColumn.new("Name",
			Gtk::CellRendererText.new, {:text => 1})      
  
column2.set_sort_column_id(1)
renderer = Gtk::CellRendererText.new
renderer.set_editable(true)

sev_ls_value=Gtk::ListStore.new(String)
$status[0..3].each {|sev|
 iter = sev_ls_value.append
 iter[0] = sev
}

sev_renderer=Gtk::CellRendererCombo.new
column3 = Gtk::TreeViewColumn.new("Severity", sev_renderer, "text" => 2)
column3.set_sort_column_id(2)
sev_renderer.model = sev_ls_value
sev_renderer.text_column = 0
sev_renderer.has_entry = false
sev_renderer.editable = true

def custom_monitor_cell_set_parameter(cell, path_string, new_text, col)
iter = @customview.model.get_iter(path_string)
iter[col] = new_text
	end

tr0 = Gtk::CellRendererText.new
	tr0.editable = true
tr0.mode =Gtk::CellRenderer::MODE_EDITABLE
tr0.signal_connect("edited") { |renderer, iter, var|
custom_monitor_cell_set_parameter(renderer, iter, var, 3) 
	}

column4 = Gtk::TreeViewColumn.new("Parameter", tr0, {:text => 3})
column4.set_sort_column_id(3)

column5 = Gtk::TreeViewColumn.new("Description", renderer, {:text => 4})
column5.visible = false

column1.signal_connect("clicked") do |column|
	toggle_select_custom()
end

sev_renderer.signal_connect("changed") {|cell, path, iter|
    sev = cell.model.get_value(iter,0)
    cell.set_background_gdk(@color_style[$status.index(sev)])
    i = @customview.selection.selected
    @customview.model.set_value(i, 2, sev)
}  

column3.set_cell_data_func(sev_renderer) do |col, renderer, model, iter|
  if iter[2] and iter[2] != ""
    ind = $status.index(iter[2])
    if ind
      color = @color_style[ind]
      if color
        renderer.set_background_gdk(color)
      end
      next
    end
  end
  renderer.background = nil
end

@customview.append_column(column1)
@customview.append_column(column2)
@customview.append_column(column3)
@customview.append_column(column4)
@customview.append_column(column5)
@customview.show

#populate with saved values
if $custom_monitor
   $custom_monitor.each do |cm_name|
   iter = custom_ls.append
   if node.custom_monitoring[cm_name] != nil
    iter[0] = node.custom_monitoring[cm_name].get_state()
   else
    iter[0] = 0
   end		
   #class name
   iter[1] = cm_name
   #default sev
    if node.custom_monitoring[cm_name] != nil
      iter[2] = node.custom_monitoring[cm_name].severity
    else
     begin
       iter[2] = Object.const_get(cm_name).default_severity()
     rescue
       #default sev is not set
       iter[2] = "CRITICAL"
     end
    end
   #param
    if node.custom_monitoring[cm_name] != nil
      iter[3] = node.custom_monitoring[cm_name].param.to_s
    else
      begin
       iter[3] = Object.const_get(cm_name).parameter().to_s
      rescue Exception => msg
        $log.error("Can't instantiate #{cm_name} plugin class #{msg}")
        iter[3] = ""
      end
    end
   #description
    begin
       iter[4] = Object.const_get(cm_name).name()
    rescue Exception => msg
        $log.error("Can't instantiate #{cm_name} plugin class #{msg}")
        iter[4] = ""
    end
  end
end

vbox.add(@customview)

label_custom = Gtk::Label::new("Custom")
notebook_inside.append_page frame, label_custom

###########################end external cmd/plugin monitoring#################################################################
 
	hbox = Gtk::HBox.new(FALSE, 1)
	hbox.add Gtk::Image.new(Gtk::Stock::EXECUTE, Gtk::IconSize::MENU)
	hbox.add Gtk::Label::new("Monitoring")
	hbox.show_all
notebook.append_page notebook_inside, hbox

######################### graph ###################################################################

#  frame = Gtk::Frame::new("Graphic monitoring")
#  frame.border_width=10
#  frame.set_size_request(300, 300)
#  frame.show

#  label = Gtk::Label::new("Graph")
#  notebook.append_page frame, label

###########################end graph#################################################################

 ok_button = Gtk::Button.new(Gtk::Stock::SAVE)
 ok_button.signal_connect("clicked") {

	Thread.kill(@scan_port_th) unless @scan_port_th == nil
	Gtk.thread_flush
	if $config.port_mon
 #store services
 if defined?(@treeview)
  node.clear_service()
   @treeview.model.each {|model, path, iter|
 	   selected = iter[0]
  	   protocol	= iter[1]
  	   port	= iter[2]
  	   service_name	= iter[3]
     sev = iter[4]
     node.add_service(protocol, port, service_name, selected, sev)
  }
  end
	end

#store snmp_monitoring
node.clear_snmp_monitoring()
nbline=0
@snmpview.model.each {|model, path, iter|
  state = iter[0]
  oidname = iter[1]
  oper = iter[2]
  threshold = iter[3]
  severity = iter[4]
  node.add_snmp_monitoring(state, oidname, oper, threshold, severity)
  nbline+=1
}
if nbline > 0 && (node.snmp_sev == UNMANAGED)
  node.set_snmp_severity(UNKNOWN)
end

#store wmi_monitoring
node.clear_wmi_monitoring()
nbline=0
@wmiview.model.each {|model, path, iter|
  state 	= iter[0]
  wminame 	= iter[1]
  oper		= iter[2]
  value= iter[3]
  severity	= iter[4]
  node.add_wmi_monitoring(state, wminame, oper, value, severity)
  nbline+=1
}
if nbline > 0 && (node.snmp_sev == UNMANAGED)
  node.set_snmp_severity(UNKNOWN)
end

	#store jmx_monitoring
	nbline=0
	db_del_jmx_monitoring(node.ip, HOSTNODE)	
	node.jmx_monitoring.each_value { |jmx|		
db_add_jmx_monitoring(node.ip, HOSTNODE, jmx.get_state(), jmx.get_ref(), jmx.get_protocol(), jmx.get_port(), jmx.get_auth(), jmx.get_attributes())
nbline+=1
	}
	if (nbline > 0) && (node.jmx_monitoring.size > 0) && (node.snmp_sev == UNMANAGED)
node.set_snmp_severity(UNKNOWN)
	end

	#store custom_monitoring
	node.clear_custom_monitoring()
	nbline=0
	custom_mon_table = Array.new()

 @customview.model.each {|model, path, iter|
    state = iter[0]
    name = iter[1]
    severity = iter[2]
    param = iter[3]
    custom_mon_table.push(Array.[](state, name,  param, $status.index(severity)))
    nbline+=1
  }
  if nbline > 0
    node.add_custom_monitoring_bulk(custom_mon_table)
  end 

if nbline > 0 && (node.custom_sev == UNMANAGED)
  node.set_custom_severity(UNKNOWN)
end

#store syslog_monitoring
node.clear_syslog_monitoring()
nbline=0
@syslogview.model.each {|model, path, iter|
  state = iter[0]
  syslog_ref 	= iter[1]
  severity	= iter[2]
  node.add_syslog_monitoring(state, syslog_ref, severity)
  nbline+=1
}
if nbline > 0 && (node.trap_sev == UNMANAGED)
  node.set_trap_severity(UNKNOWN)
end

	#store snmptrap_monitoring
	node.clear_snmptrap_monitoring()
	nbline=0
 @snmptrapview.model.each {|model, path, iter|
    		state 		= iter[0]
    		snmptrap_ref	= iter[1]
  	severity	= iter[2]
node.add_snmptrap_monitoring(state, snmptrap_ref, severity)
nbline+=1
	}
	if nbline > 0 && (node.trap_sev == UNMANAGED)
node.set_trap_severity(UNKNOWN)
	end

	#store account only in db as the lived value is already stored in @acccount hash
	node.clear_db_accounts()
	 = Array.new()
	@account_view.model.each {|model, path, iter|
 idname     = iter[0]
    	  		= iter[1]
 password  = iter[2]
 .push([idname, , password])
	}
	if .length > 0
 node.()
	end


#general
if entry_x.text.to_i >= 0 && entry_x.text.to_i <= $win.window.geometry[2]
  node.x = entry_x.text.to_i
end
if entry_y.text.to_i >= 0 && entry_y.text.to_i <= $win.window.geometry[3]
  node.y = entry_y.text.to_i
end

need_reload_icon=0

if entry_os.name != node.os || entry_type.name != node.type
  need_reload_icon=1
end

if isValidIPv4(entry_ip.text)
  node.ip = entry_ip.text
end

nodeid=db_get_node_id(node.ip, HOSTNODE)

node.netmask = entry_mask.text.to_i
db_set_mask(nodeid, node.netmask)

if (entry_mac.text=="") || (entry_mac.text.match('\s+'))
	node.mac=Node::NOARP_PROPERTY
else
	node.mac = entry_mac.text
end
db_set_mac(nodeid, node.mac)

if (entry_name.text=="") || (entry_name.text.match('\s+'))
	node.dns_name=Node::NONAME_PROPERTY
else
	node.dns_name = entry_name.text
end
if (entry_netbiosname.text=="") || (entry_netbiosname.text.match('\s+'))
	node.netbios_name=Node::NONAME_PROPERTY
else
	node.netbios_name = entry_netbiosname.text
end
if (entry_desc.text=="") || (entry_desc.text.match('\s+'))
	node.description=Node::NODESCR_PROPERTY
else
	node.description = entry_desc.text
end
db_set_description(nodeid, node.description)

node.os = entry_os.name
if entry_type.filename != nil
  node.change_type(entry_type.name)
end
node.change_label()
if need_reload_icon == 1
  node.reload
end

Thread.kill(refresh_node_sev_display)
Gtk.thread_flush
window.destroy
	
	}

	cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
	cancel_button.signal_connect("clicked") {
#we rollback the jmx monitoring from the db
node.init_jmx_from_db()
#we rollback here the account from the db to the @account hash
node.()
Thread.kill(@scan_port_th) unless @scan_port_th == nil
Gtk.thread_flush
Thread.kill(refresh_node_sev_display)
Gtk.thread_flush
window.destroy
	}
	
	hbox=Gtk::HBox.new(FALSE, 10)
	hbox.border_width=10
	hbox.show
	hbox.pack_start(ok_button, TRUE, TRUE, 0)
	ok_button.set_flags(Gtk::Widget::CAN_DEFAULT);
	hbox.pack_start(cancel_button, TRUE, TRUE, 0)
	cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT);
	separator = Gtk::HSeparator::new()
	vboxb.pack_start(separator, FALSE, TRUE, 0)
	separator.show
	vboxb.pack_start(hbox, FALSE, TRUE, 0)
	ok_button.show
	cancel_button.show

	window.show

end

Instance Method Details

#add_monitored_jmx(node, mode = nil) ⇒ Object



610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
# File 'lib/gui/node_host_property.rb', line 610

def add_monitored_jmx(node, mode=nil)
	jmxref=nil
	protocol="rmi"
	port=nil
	auth=nil
	jmxattr_h=Hash.new

    addjmxwin=Gtk::Window.new
    addjmxwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
	 if mode
		 if @jmxview.selection.selected == nil
			return
		 end
		 title="Edit monitored jmx Ref"
		 iter=@jmxview.selection.selected
		 jmxref=iter[1]
		 protocol=iter[2].split("/")[0]
	    	 port=iter[2].split("/")[1]
		 auth=iter[3]
  	 else
		 title="Add monitored jmx Ref"
    end

    addjmxwin.set_title(title)
    addjmxwin.set_size_request(340, 300)
    addjmxwin.set_modal(true)

    addjmxwin.signal_connect("key_press_event") {|w,e|
      if e.keyval == Gdk::Keyval::GDK_Escape
			addjmxwin.destroy
      end
    }

    frame = Gtk::Frame::new
    frame.border_width=10
    frame.show
    vbox_root=Gtk::VBox::new
    vbox_root.show
    addjmxwin.add vbox_root
    vbox_root.add frame
    vbox = Gtk::VBox.new
    vbox.show
    frame.add vbox

    table = Gtk::Table.new(4,2,false)
    table.show

   label_jmxref = Gtk::Label.new "JMX Ref"
   label_jmxref.show
   entry_jmxref = Gtk::ComboBox.new
   if mode 
	entry_jmxref.set_sensitive(false)
   end
   JMXRef::get_jmx_refs_name().each {|ref|
      entry_jmxref.append_text(ref)
   }
   if jmxref
      ind = JMXRef::get_jmx_refs_name().index(jmxref)
      entry_jmxref.set_active(ind) if ind
   else
      entry_jmxref.set_active(0)
   end

   entry_jmxref.set_size_request(150, -1)
   entry_jmxref.show
   bbox=Gtk::HButtonBox.new
   bbox.show
   bbox.add entry_jmxref
   table.attach(label_jmxref,0,1,0,1)
   table.attach(bbox,1,2,0,1)

   entry_protocol = Gtk::Entry.new
   entry_protocol.set_text(protocol) unless protocol==nil
   entry_protocol.set_sensitive(false)
   label_protocol = Gtk::Label.new "Protocol"
   label_protocol.show
   entry_protocol.set_size_request(150, -1)
   entry_protocol.show
   bbox=Gtk::HButtonBox.new
   bbox.show
   bbox.add entry_protocol
   table.attach(label_protocol,0,1,1,2)
   table.attach(bbox,1,2,1,2)

   entry_port = Gtk::Entry.new
   entry_port.set_text(port) unless port==nil
   label_port = Gtk::Label.new "Port"
   label_port.show
   entry_port.set_size_request(150, -1)
   entry_port.show
   bbox=Gtk::HButtonBox.new
   bbox.show
   bbox.add entry_port
   table.attach(label_port,0,1,2,3)
   table.attach(bbox,1,2,2,3)

   label_auth = Gtk::Label.new "Authentication"
   label_auth.show
   entry_auth = Gtk::ComboBox.new
   node.().keys.unshift("None").each {|authval|
            entry_auth.append_text(authval)
   }
   if auth
      ind = node.().keys.unshift("None").index(auth)
      entry_auth.set_active(ind) if ind
   else
      entry_auth.set_active(0)
   end
   entry_auth.set_size_request(150, -1)
   entry_auth.show
   bbox=Gtk::HButtonBox.new
   bbox.show
   bbox.add entry_auth
   table.attach(label_auth,0,1,3,4)
   table.attach(bbox,1,2,3,4)
 
   jmxls = Gtk::TreeStore.new(String, String, String, String)
   @jmxtv = Gtk::TreeView.new(jmxls)
   @jmxtv_nb_entry=0

	model=Gtk::ListStore.new(String)
	$jmx_refs[entry_jmxref.active_text].attribute.split.each {|attr|
		if attr != ""
			iter = model.append
			iter[0] = attr
		end
	}

	model2=Gtk::ListStore.new(String)
	JmxAttributeMonitoring::TESTOP.each {|op|
		iter = model2.append
		iter[0] = op
	}

	model4=Gtk::ListStore.new(String)
	$status[0..3].each {|sev|
		iter = model4.append
		iter[0] = sev
	}

  renderer1=Gtk::CellRendererCombo.new
  column1 = Gtk::TreeViewColumn.new("Attribute", renderer1, "text" => 0)
  renderer1.model = model
  renderer1.text_column = 0
  renderer1.has_entry = false
  renderer1.editable = true
  renderer1.signal_connect('edited') do |w, path, new_text|
    if path != ""
      iter = @jmxtv.model.get_iter(path)
      iter[0] = new_text
    end
  end
  column1.set_sort_column_id(0)

	renderer2=Gtk::CellRendererCombo.new
	column2 = Gtk::TreeViewColumn.new("Operator", renderer2, "text" => 1)
	column2.set_sort_column_id(1)
	renderer2.model = model2
	renderer2.text_column = 0
  	renderer2.has_entry = false
  	renderer2.editable = true
	renderer2.signal_connect('edited') do |w, path, new_text|
    		if path != ""
			iter = @jmxtv.model.get_iter(path)
        		iter[1] = new_text
			jmxattr_h[iter[0]].set_operator(JmxAttributeMonitoring::TESTOP.index(new_text))
      		end
	end

	def cell_jmx_attr_value_edited(cell, path_string, new_text, col, node, jmxattr_h)
		iter = @jmxtv.model.get_iter(path_string)
		iter[col] = new_text
		jmxattr_h[iter[0]].set_value(new_text)
	end

	tr0=Gtk::CellRendererText.new
	tr0.editable=true
  tr0.mode=Gtk::CellRenderer::MODE_EDITABLE
	tr0.signal_connect("edited") { |renderer, iter, var|
		cell_jmx_attr_value_edited(renderer, iter, var, 2, node, jmxattr_h) 
	}
	column3 = Gtk::TreeViewColumn.new("Value", tr0, "text" => 2)
	column3.set_sort_column_id(2)

  renderer4=Gtk::CellRendererCombo.new
  column4 = Gtk::TreeViewColumn.new("Severity", renderer4, "text" => 3)
  column4.set_sort_column_id(3)
  renderer4.model = model4
  renderer4.text_column = 0
  renderer4.has_entry = false
  renderer4.editable = true
  renderer4.signal_connect('edited') do |w, path, new_text|
    if path != ""
      iter = @jmxtv.model.get_iter(path)
      iter[3] = new_text
      jmxattr_h[iter[0]].set_severity($status.index(new_text))
    end
  end
	
	column4.set_cell_data_func(renderer4) do |col, renderer, model, iter|
	  if iter[3] and iter[3] != ""
	    renderer.set_background_gdk(@color_style[$status.index(iter[3])])
	  else
	    renderer.background = nil
	  end
        end

	@jmxtv.append_column(column1)
	@jmxtv.append_column(column2)
	@jmxtv.append_column(column3)
	@jmxtv.append_column(column4)

	if mode
		#load existing jmx attribute table
		if node.jmx_monitoring[entry_jmxref.active_text]
			attr_h=node.jmx_monitoring[entry_jmxref.active_text].get_attributes()
			attr_h.each_value { |attr|
				parent=jmxls.append(nil)
				parent[0]=attr.attributeName
				parent[1]=JmxAttributeMonitoring::TESTOP[attr.operator]
				parent[2]=attr.value.to_s
				parent[3]=$status[attr.severity]
				jmxattr_h[parent[0]]=JmxAttributeMonitoring.new(parent[0], attr.operator, parent[2], attr.severity)
				@jmxtv_nb_entry+=1
			}
		end
	end
	
	#create menu
	menu_jmx_attr = Gtk::Menu.new

	item_add_jmx_attr = Gtk::ImageMenuItem.new("Add JMX Attribute")
 	image_item_add_jmx_attr = Gtk::Image.new()
 	image_item_add_jmx_attr.set_stock(Gtk::Stock::ADD)
	item_add_jmx_attr.set_image(image_item_add_jmx_attr)
	item_add_jmx_attr.signal_connect("activate") {
		insert_jmx_attr_entry(node, jmxattr_h, entry_jmxref)
	}
	menu_jmx_attr.append(item_add_jmx_attr)

	item_del_jmx_attr = Gtk::ImageMenuItem.new("Delete JMX Attribute")
 	image_item_del_jmx_attr = Gtk::Image.new() 
 	image_item_del_jmx_attr.set_stock(Gtk::Stock::REMOVE) 
	item_del_jmx_attr.set_image(image_item_del_jmx_attr)
	item_del_jmx_attr.signal_connect("activate") {|renderer, iter, var|
		remove_selected_jmx_attr_entry(node, jmxattr_h, entry_jmxref)	
	}
	menu_jmx_attr.append(item_del_jmx_attr)
	menu_jmx_attr.show_all
	
	@jmxtv.signal_connect("button_press_event") do |widget, event|
		if event.kind_of? Gdk::EventButton and event.button == 3
			menu_jmx_attr.popup(nil, nil, event.button, event.time)
		end
	end
		
	@jmxtv.signal_connect("key_press_event") {|w,e|
    		if e.keyval == Gdk::Keyval::GDK_Delete
			remove_selected_jmx_attr_entry(node, jmxattr_h, entry_jmxref)
	    	elsif e.keyval == Gdk::Keyval::GDK_Insert
			insert_jmx_attr_entry(node, jmxattr_h, entry_jmxref)
		end
	}

 	def insert_jmx_attr_entry(node, jmxattr_h, mbean)
		if $jmx_refs[mbean.active_text].attribute.split.size > @jmxtv_nb_entry
			iter=@jmxtv.model.append(nil)
			val=""
			$jmx_refs[mbean.active_text].attribute.split.each {|attr|
				if !jmxattr_h[mbean.active_text]
					val=attr
					break
				elsif !jmxattr_h[attr]
					val=attr
					break
				end
			}
			if val != ""
				#as we insert the attribute we blocked the mbean name
				mbean.set_sensitive(false)
				iter[0] = val
				iter[1] = JmxAttributeMonitoring::TESTOP[0]
				iter[2] = "0"
				iter[3] = $status[0]
				jmxattr_h[iter[0]]=JmxAttributeMonitoring.new(iter[0],0,iter[2],0)
				@jmxtv_nb_entry+=1
			end
		end
  	end
	
	def remove_selected_jmx_attr_entry(node, jmxattr_h, mbean)
		if @jmxtv.selection.selected
		    jmxattr_h.delete(@jmxtv.model.get_value(@jmxtv.selection.selected,0))
		    @jmxtv.model.remove(@jmxtv.selection.selected)
		    @jmxtv_nb_entry-=1
		    if @jmxtv_nb_entry == 0
		       mbean.set_sensitive(true)
		    end
		end
	end
		
    ok_button = Gtk::Button.new(Gtk::Stock::OK)
    ok_button.show
    ok_button.signal_connect("clicked") {
		if (entry_port.text != "") && (isInteger(entry_port.text))
		   if mode
			   #here we just modify this jmx ref
			   iter=@jmxview.selection.selected
			   iter[1] = entry_jmxref.active_text
			   iter[2] = entry_protocol.text + "/" + entry_port.text
			   iter[3] = entry_auth.active_text
			   node.jmx_monitoring[entry_jmxref.active_text].set_protocol(entry_protocol.text)
			   node.jmx_monitoring[entry_jmxref.active_text].set_port(entry_port.text)
			   node.jmx_monitoring[entry_jmxref.active_text].set_auth(entry_auth.active_text)
			   node.jmx_monitoring[entry_jmxref.active_text].clear_attributes()
			   jmxattr_h.each_value {|attr|
				node.jmx_monitoring[entry_jmxref.active_text].add_attribute(attr.attributeName, attr.operator, attr.value, attr.severity)
			   }
     			   addjmxwin.destroy()
		   else
			   #new entry
			   list_rows = 0
			   @jmxtv.model.each {|model, path, it|			   
                           list_rows += 1
			   if  "#{it[2]}" != ""
				   #need to test if already exists
				   error_detected=0
				   @jmxview.model.each {|model, path, iter|
				   if "#{iter[1]}" == "#{entry_jmxref.active_text}"
					   error_detected=1
					   break
				   end
				   }
				   if error_detected == 0
					   iter=@jmxview.model.append
					   iter[0] = 1
					   iter[1] = entry_jmxref.active_text
					   iter[2] = entry_protocol.text + "/" + entry_port.text
					   iter[3] = entry_auth.active_text
					   
					   node.add_jmx_monitoring(iter[0], iter[1], entry_protocol.text, entry_port.text, entry_auth.active_text, jmxattr_h)
    					   addjmxwin.destroy()
				   else
					    errorEntry(addjmxwin, "jmx Ref already set")
				   end
			   else
				   errorEntry(addjmxwin, "jmx Ref, you must set a value")
			   end
			   }
			   errorEntry(addjmxwin, "jmx attributes not set") if list_rows == 0
		   end
		else
			 entry_port.grab_focus()
		         errorEntry(addjmxwin, "Port should be a valid integer")
		end
    }

    cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
    cancel_button.show
    cancel_button.signal_connect("clicked") {
  	    addjmxwin.destroy 
    }

	 bbox =Gtk::HBox::new(FALSE, 10)
	 bbox.border_width=10
	 bbox.show

	 ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
	 bbox.pack_start(ok_button, TRUE, TRUE, 0)
	 cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
	 bbox.pack_start(cancel_button, TRUE, TRUE, 0)

	 vbox.add(table)
	 vbox.add(@jmxtv)
	 separator = Gtk::HSeparator::new()
	 separator.show
	 vbox_root.pack_start(separator, FALSE, TRUE, 0)
	 vbox_root.pack_start(bbox, FALSE, TRUE, 0)

    addjmxwin.show_all
end

#add_monitored_service(mode = nil) ⇒ Object

add or modify an existing service



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/gui/node_host_property.rb', line 40

def add_monitored_service(mode=nil)

 protocol=nil
 port=nil
 service_name=nil
 severity=nil
 
   addportwin=Gtk::Window.new
   addportwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
 if mode
	 if @treeview.selection.selected == nil
		return
	 end
	 title="Edit monitored service"
	 iter=@treeview.selection.selected
	 protocol=iter[1]
	 port=iter[2]
    service_name=iter[3]
    severity=iter[4]
 	 else
	 title="Add monitored service"
   end

   addportwin.set_title(title)
   addportwin.set_size_request(315, -1)
   addportwin.set_modal(true)

   addportwin.signal_connect("key_press_event") {|w,e|
     if e.keyval == Gdk::Keyval::GDK_Escape
		addportwin.destroy
     end
   }

   frame = Gtk::Frame::new
   frame.border_width=10
   frame.show
   vbox_root=Gtk::VBox::new
   vbox_root.show
   addportwin.add vbox_root
   vbox_root.add frame
   vbox = Gtk::VBox.new
   vbox.show
   frame.add vbox

   table = Gtk::Table.new(4,2,false)
   table.show

   entry_serv = Gtk::Entry.new
   entry_serv.set_text(service_name) unless service_name==nil
   label_proto = Gtk::Label.new "Protocol"
   label_proto.show

 	 entry_proto = Gtk::ComboBox.new
        protos = ["tcp","udp"]
        protos.each {|p|
           entry_proto.append_text(p)
        }
        if protocol
           ind = protos.index(protocol)
           entry_proto.set_active(ind) if ind
        else
           ind = protos.index("tcp")
           entry_proto.set_active(ind) if ind
        end
 entry_proto.set_size_request(20,-1)
 entry_proto.show

 bbox=Gtk::HButtonBox.new
 bbox.show
 bbox.add entry_proto
   table.attach(label_proto,0,1,0,1)
   table.attach(bbox,1,2,0,1)

 label_port = Gtk::Label.new "Port"
 label_port.show
 entry_port = Gtk::Entry.new
 entry_port.set_max_length 5
 entry_port.set_text(port.to_s()) unless port==nil
 entry_port.set_size_request(20,-1)
 entry_port.show
 entry_port.signal_connect("changed") {
	 entry_serv.text=service_name(entry_proto.active_text, entry_port.text)
 }
 entry_proto.signal_connect("changed") {
	 entry_serv.text=service_name(entry_proto.active_text, entry_port.text) unless entry_port.text==nil
 }
 bbox=Gtk::HButtonBox.new
 bbox.show
 bbox.add entry_port
   table.attach(label_port,0,1,1,2)
   table.attach(bbox,1,2,1,2)

   label_serv = Gtk::Label.new "Service"
   label_serv.show
   entry_serv.set_size_request(20,-1)
   entry_serv.show
   bbox=Gtk::HButtonBox.new
   bbox.show
   bbox.add entry_serv
   table.attach(label_serv,0,1,2,3)
   table.attach(bbox,1,2,2,3)

   label_sev = Gtk::Label.new "Severity"
   label_sev.show
   entry_sev = Gtk::ComboBox.new
   $status[0..3].each {|sev|
     entry_sev.append_text(sev)
   }
   entry_sev.signal_connect("changed") {
     entry_sev.child.set_background_gdk(@color_style[entry_sev.active])
   }
  ind = 0
  if severity
     ind = $status[0..3].index(severity)
     entry_sev.set_active(ind) if ind
  else
     entry_sev.set_active(ind)            
  end
  entry_sev.child.set_background_gdk(@color_style[ind])
       
 entry_sev.set_size_request(150,-1)
 entry_sev.show
 bbox=Gtk::HButtonBox.new
 bbox.show
 bbox.add entry_sev
   table.attach(label_sev,0,1,3,4)
   table.attach(bbox,1,2,3,4)

   ok_button = Gtk::Button.new(Gtk::Stock::OK)
   ok_button.show
   ok_button.signal_connect("clicked") {
	if mode
		#here we just modify this service
		if isValidPort(entry_port.text.to_i())		
		  iter=@treeview.selection.selected
		  iter[1] = entry_proto.active_text
		  iter[2] = entry_port.text.to_i
		  iter[3] = entry_serv.text
		  iter[4] = entry_sev.active_text
                         addportwin.destroy()
		else
			errorEntry(addportwin, "Bad port #{entry_port.entry.text}")
		end
	else
		  #just add this service
  	  if isValidPort(entry_port.text.to_i())
		  search_mon_port=false
		  @treeview.model.each {|model, path, iter|
			 if iter[2]==entry_port.text.to_i && iter[1]==entry_proto.active_text
				 search_mon_port=true
				 break
			 end
		  }

		 if search_mon_port==false
			iter=@treeview.model.append
			iter[0] = 1
			iter[1] = entry_proto.active_text
			iter[2] = entry_port.text.to_i
			iter[3] = entry_serv.text
			iter[4] = entry_sev.active_text
     		                addportwin.destroy()
		 else
			 errorEntry(addportwin, "#{entry_proto.active_text}/#{entry_port.text} already exists")
		 end
  	  else 
 	   	  	errorEntry(addportwin, "Bad port #{entry_port.text}")
  	  end
	end
   }

   cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
   cancel_button.show
   cancel_button.signal_connect("clicked") {
 	    addportwin.destroy 
   }

 bbox =Gtk::HBox::new(FALSE, 10)
 bbox.border_width=10
 bbox.show

 ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
 bbox.pack_start(ok_button, TRUE, TRUE, 0)
 cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
 bbox.pack_start(cancel_button, TRUE, TRUE, 0)

 vbox.add(table)
 separator = Gtk::HSeparator::new()
 separator.show
 vbox_root.pack_start(separator, FALSE, TRUE, 0)
 vbox_root.pack_start(bbox, FALSE, TRUE, 0)

   addportwin.show

end

#add_monitored_snmp(mode = nil) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/gui/node_host_property.rb', line 236

def add_monitored_snmp(mode=nil)
  oidref=nil
  operator=nil
  threshold=nil
  severity=nil

  addsnmpwin=Gtk::Window.new
  addsnmpwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
  if mode
    if @snmpview.selection.selected == nil
      return
    end
    title="Edit monitored SNMP OID"
    iter=@snmpview.selection.selected
    oidref=iter[1]
    operator=iter[2]
    threshold=iter[3]
    severity=iter[4]
  else
    title="Add monitored SNMP OID"
  end

  addsnmpwin.set_title(title)
  addsnmpwin.set_size_request(340, -1)
  addsnmpwin.set_modal(true)

  addsnmpwin.signal_connect("key_press_event") {|w,e|
    if e.keyval == Gdk::Keyval::GDK_Escape
      addsnmpwin.destroy
    end
  }

  frame = Gtk::Frame::new
  frame.border_width=10
  frame.show
  vbox_root=Gtk::VBox::new
  vbox_root.show
  addsnmpwin.add vbox_root
  vbox_root.add frame
  vbox = Gtk::VBox.new
  vbox.show
  frame.add vbox

  table = Gtk::Table.new(4,2,false)
  table.show

  label_oidref = Gtk::Label.new "OID Ref"
  label_oidref.show
  entry_oidref = Gtk::ComboBox.new
  OIDRef::get_oid_refs_name().each {|oid|
    entry_oidref.append_text(oid)
  }
  if oidref
    ind = OIDRef::get_oid_refs_name().index(oidref)
    entry_oidref.set_active(ind) if ind
  else
    entry_oidref.set_active(0)
  end
  entry_oidref.set_size_request(150,-1)
  entry_oidref.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_oidref
  table.attach(label_oidref,0,1,0,1)
  table.attach(bbox,1,2,0,1)

  label_operator = Gtk::Label.new "Operator"
  label_operator.show
  entry_operator = Gtk::ComboBox.new
  SnmpMonitoring::TESTOP.each {|ope|
    entry_operator.append_text(ope)
  }
  if operator
    ind = SnmpMonitoring::TESTOP.index(operator)
    entry_operator.set_active(ind) if ind
  else
    entry_operator.set_active(0)
  end

  entry_operator.set_size_request(150,-1)
  entry_operator.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_operator
  table.attach(label_operator,0,1,1,2)
  table.attach(bbox,1,2,1,2)

  entry_threshold = Gtk::Entry.new
  entry_threshold.set_text(threshold) unless threshold==nil
  label_threshold = Gtk::Label.new "Threshold"
  label_threshold.show
  entry_threshold.set_size_request(150,-1)
  entry_threshold.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_threshold
  table.attach(label_threshold,0,1,2,3)
  table.attach(bbox,1,2,2,3)

  label_sev = Gtk::Label.new "Severity"
  label_sev.show
  entry_sev = Gtk::ComboBox.new
  $status[0..3].each {|sev|
    entry_sev.append_text(sev)
  }
  entry_sev.signal_connect("changed") {
    entry_sev.child.set_background_gdk(@color_style[entry_sev.active])
  }
  ind = 0
  if severity
    ind = $status[0..3].index(severity)
    entry_sev.set_active(ind) if ind
  else
    entry_sev.set_active(ind)
  end
  entry_sev.child.set_background_gdk(@color_style[ind])

  entry_sev.set_size_request(150,-1)
  entry_sev.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_sev
  table.attach(label_sev,0,1,3,4)
  table.attach(bbox,1,2,3,4)

  ok_button = Gtk::Button.new(Gtk::Stock::OK)
  ok_button.show
  ok_button.signal_connect("clicked") {
    if mode
      #here we just modify this service
      iter=@snmpview.selection.selected
      iter[1] = entry_oidref.active_text
      iter[2] = entry_operator.active_text
      iter[3] = entry_threshold.text
      iter[4] = entry_sev.active_text
      addsnmpwin.destroy()
    else
      if isInteger(entry_threshold.text)
        #need to test if already exists
        error_detected=0
        @snmpview.model.each {|model, path, iter|
          if "#{iter[1]}" == "#{entry_oidref.active_text}"
            error_detected=1
            break
          end
        }
        if error_detected == 0
          iter=@snmpview.model.append
          iter[0] = 1
          iter[1] = entry_oidref.active_text
          iter[2] = entry_operator.active_text
          iter[3] = entry_threshold.text
          iter[4] = entry_sev.active_text
          addsnmpwin.destroy()
        else
          errorEntry(addsnmpwin, "OID Ref already set")
        end
      else
        errorEntry(addsnmpwin, "Threshold #{entry_threshold.text} need to be an integer")
      end
    end
  }

  cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
  cancel_button.show
  cancel_button.signal_connect("clicked") {
    addsnmpwin.destroy
  }

  bbox =Gtk::HBox::new(FALSE, 10)
  bbox.border_width=10
  bbox.show

  ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
  bbox.pack_start(ok_button, TRUE, TRUE, 0)
  cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
  bbox.pack_start(cancel_button, TRUE, TRUE, 0)

  vbox.add(table)
  separator = Gtk::HSeparator::new()
  separator.show
  vbox_root.pack_start(separator, FALSE, TRUE, 0)
  vbox_root.pack_start(bbox, FALSE, TRUE, 0)

  addsnmpwin.show
end

#add_monitored_snmptrap(mode = nil) ⇒ Object



1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
# File 'lib/gui/node_host_property.rb', line 1001

def add_monitored_snmptrap(mode=nil)
	 snmptrapref=nil
	 severity=nil

	 #list already snmptrap ref configured
	 snmptrap_ref_list=[]

	 if mode
		 if @snmptrapview.selection.selected == nil
			return
		 end
		 title="Edit monitored SNMP Trap Ref"
		 iter=@snmptrapview.selection.selected
		 snmptrapref=iter[1]
		 severity=iter[2]
  	 else
		title="Add monitored SNMP Trap Ref"
		snmptrap_ref_list=get_snmptrap_refs_left()
		if snmptrap_ref_list.size() == 0
			return
		end
    end

    addsnmptrapwin=Gtk::Window.new
    addsnmptrapwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
    addsnmptrapwin.set_title(title)
    addsnmptrapwin.set_size_request(340, -1)
    addsnmptrapwin.set_modal(true)

    addsnmptrapwin.signal_connect("key_press_event") {|w,e|
      if e.keyval == Gdk::Keyval::GDK_Escape
			addsnmptrapwin.destroy
      end
    }

    frame = Gtk::Frame::new
    frame.border_width=10
    frame.show
    vbox_root=Gtk::VBox::new
    vbox_root.show
    addsnmptrapwin.add vbox_root
    vbox_root.add frame
    vbox = Gtk::VBox.new
    vbox.show
    frame.add vbox

    table = Gtk::Table.new(4,2,false)
    table.show

    label_snmptrapref = Gtk::Label.new "SNMP Trap Ref"
    label_snmptrapref.show
    entry_snmptrapref = Gtk::ComboBox.new
    snmp_trap_list=snmptrap_ref_list
    if mode
	     snmp_trap_list = SnmpTrapRef::get_snmptrap_refs_name()
    end
    snmp_trap_list.each {|slist|
       entry_snmptrapref.append_text(slist)
    }
    if snmptrapref
       ind = snmp_trap_list.index(snmptrapref)
       entry_snmptrapref.set_active(ind) if ind
    else
       entry_snmptrapref.set_active(0)
    end
    entry_snmptrapref.set_size_request(150, -1)
    entry_snmptrapref.show
    bbox=Gtk::HButtonBox.new
    bbox.show
    bbox.add entry_snmptrapref
    table.attach(label_snmptrapref,0,1,0,1)
    table.attach(bbox,1,2,0,1)

    label_sev = Gtk::Label.new "Severity"
    label_sev.show
    entry_sev = Gtk::ComboBox.new
    $status[0..3].each {|sev|
       entry_sev.append_text(sev)
    }
   entry_sev.signal_connect("changed") {
     entry_sev.child.set_background_gdk(@color_style[entry_sev.active])
   }
   ind = 0
   if severity
      ind = $status[0..3].index(severity)
      entry_sev.set_active(ind) if ind
   else
      entry_sev.set_active(ind)            
   end
   entry_sev.child.set_background_gdk(@color_style[ind])
        
    entry_sev.set_size_request(150, -1)
    entry_sev.show
    bbox=Gtk::HButtonBox.new
    bbox.show
    bbox.add entry_sev
    table.attach(label_sev,0,1,1,2)
    table.attach(bbox,1,2,1,2)

    ok_button = Gtk::Button.new(Gtk::Stock::OK)
    ok_button.show
    ok_button.signal_connect("clicked") {
		iter=nil
		if mode
			#here we just modify this service
			iter=@snmptrapview.selection.selected
		else
			iter=@snmptrapview.model.append
			iter[0] = 1
		end
		iter[1] = entry_snmptrapref.active_text
		iter[2] = entry_sev.active_text
                iter[3] = $snmptrap_refs[ entry_snmptrapref.active_text].description
     	addsnmptrapwin.destroy()
    }

    cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
    cancel_button.show
    cancel_button.signal_connect("clicked") {
  	    addsnmptrapwin.destroy 
    }

	 bbox =Gtk::HBox::new(FALSE, 10)
	 bbox.border_width=10
	 bbox.show

	 ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
	 bbox.pack_start(ok_button, TRUE, TRUE, 0)
	 cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
	 bbox.pack_start(cancel_button, TRUE, TRUE, 0)

	 vbox.add(table)
	 separator = Gtk::HSeparator::new()
	 separator.show
	 vbox_root.pack_start(separator, FALSE, TRUE, 0)
	 vbox_root.pack_start(bbox, FALSE, TRUE, 0)

    addsnmptrapwin.show
end

#add_monitored_syslog(mode = nil) ⇒ Object



1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
# File 'lib/gui/node_host_property.rb', line 1150

def add_monitored_syslog(mode=nil)
  syslogpref=nil
  severity=nil

  #list already syslog ref configured
  syslog_ref_list=[]

  if mode
    if @syslogview.selection.selected == nil
      return
    end
    title="Edit monitored Syslog Ref"
    iter=@syslogview.selection.selected
    syslogpref=iter[1]
    severity=iter[2]
  else
    title="Add monitored Syslog Ref"
    syslog_ref_list=get_syslog_refs_left()
    if syslog_ref_list.size() == 0
      return
    end
  end

  addsyslogwin=Gtk::Window.new
  addsyslogwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
  addsyslogwin.set_title(title)
  addsyslogwin.set_size_request(340, -1)
  addsyslogwin.set_modal(true)

  addsyslogwin.signal_connect("key_press_event") {|w,e|
    if e.keyval == Gdk::Keyval::GDK_Escape
      addsyslogwin.destroy
    end
  }

  frame = Gtk::Frame::new
  frame.border_width=10
  frame.show
  vbox_root=Gtk::VBox::new
  vbox_root.show
  addsyslogwin.add vbox_root
  vbox_root.add frame
  vbox = Gtk::VBox.new
  vbox.show
  frame.add vbox

  table = Gtk::Table.new(4,2,false)
  table.show

  label_oidref = Gtk::Label.new "Syslog Ref"
  label_oidref.show
  entry_oidref = Gtk::ComboBox.new
  if mode
    syslog_ref_list = SyslogRef::get_syslog_refs_name()
  end

  syslog_ref_list.each {|ref|
    entry_oidref.append_text(ref)
  }
  if syslogpref
    ind = syslog_ref_list.index(syslogpref)
    entry_oidref.set_active(ind) if ind
  else
    entry_oidref.set_active(0)
  end
  entry_oidref.set_size_request(150, -1)
  entry_oidref.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_oidref
  table.attach(label_oidref,0,1,0,1)
  table.attach(bbox,1,2,0,1)

  label_sev = Gtk::Label.new "Severity"
  label_sev.show
  entry_sev = Gtk::ComboBox.new
  sevs = [MAP_SYSLOG_SEV]+$status[0..3]
  sevs.each {|sev|
    entry_sev.append_text(sev)
  }
   entry_sev.signal_connect("changed") {
     if entry_sev.active > 0
        entry_sev.child.set_background_gdk(@color_style[entry_sev.active-1])
     end
   }
   ind = 0
   if severity
      ind = sevs.index(severity)
      entry_sev.set_active(ind) if ind
   else
      entry_sev.set_active(ind)            
   end
   if ind > 0
      entry_sev.child.set_background_gdk(@color_style[ind-1])
   end
  
  entry_sev.set_size_request(150, -1)
  entry_sev.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_sev
  table.attach(label_sev,0,1,1,2)
  table.attach(bbox,1,2,1,2)

  ok_button = Gtk::Button.new(Gtk::Stock::OK)
  ok_button.show
  ok_button.signal_connect("clicked") {
    iter=nil
    if mode
      #here we just modify this service
      iter=@syslogview.selection.selected
    else
      iter=@syslogview.model.append
      iter[0] = 1
    end
    iter[1] = entry_oidref.active_text
    iter[2] = entry_sev.active_text
    iter[3] = $syslog_refs[entry_oidref.active_text].description
    addsyslogwin.destroy()
  }

  cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
  cancel_button.show
  cancel_button.signal_connect("clicked") {
    addsyslogwin.destroy
  }

  bbox =Gtk::HBox::new(FALSE, 10)
  bbox.border_width=10
  bbox.show

  ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
  bbox.pack_start(ok_button, TRUE, TRUE, 0)
  cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
  bbox.pack_start(cancel_button, TRUE, TRUE, 0)

  vbox.add(table)
  separator = Gtk::HSeparator::new()
  separator.show
  vbox_root.pack_start(separator, FALSE, TRUE, 0)
  vbox_root.pack_start(bbox, FALSE, TRUE, 0)

  addsyslogwin.show
end

#add_monitored_wmi(mode = nil) ⇒ Object



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
# File 'lib/gui/node_host_property.rb', line 424

def add_monitored_wmi(mode=nil)
  wmiref=nil
  operator=nil
  value=nil
  severity=nil

  addwmiwin=Gtk::Window.new
  addwmiwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
  if mode
    if @wmiview.selection.selected == nil
      return
    end
    title="Edit monitored WMI Ref"
    iter=@wmiview.selection.selected
    wmiref=iter[1]
    operator=iter[2]
    value=iter[3]
    severity=iter[4]
  else
    title="Add monitored WMI Ref"
  end

  addwmiwin.set_title(title)
  addwmiwin.set_size_request(340, -1)
  addwmiwin.set_modal(true)

  addwmiwin.signal_connect("key_press_event") {|w,e|
    if e.keyval == Gdk::Keyval::GDK_Escape
      addwmiwin.destroy
    end
  }

  frame = Gtk::Frame::new
  frame.border_width=10
  frame.show
  vbox_root=Gtk::VBox::new
  vbox_root.show
  addwmiwin.add vbox_root
  vbox_root.add frame
  vbox = Gtk::VBox.new
  vbox.show
  frame.add vbox

  table = Gtk::Table.new(4,2,false)
  table.show

  label_wmiref = Gtk::Label.new "WMI Ref"
  label_wmiref.show
  entry_wmiref = Gtk::ComboBox.new
  WMIRef::get_wmi_refs_name().each {|ref|
    entry_wmiref.append_text(ref)
  }
  if wmiref
    ind = WMIRef::get_wmi_refs_name().index(wmiref)
    entry_wmiref.set_active(ind) if ind
  else
    entry_wmiref.set_active(0)
  end
  entry_wmiref.set_size_request(150, -1)
  entry_wmiref.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_wmiref
  table.attach(label_wmiref,0,1,0,1)
  table.attach(bbox,1,2,0,1)

  label_operator = Gtk::Label.new "Operator"
  label_operator.show
  entry_operator = Gtk::ComboBox.new
  WmiMonitoring::TESTOP.each {|ope|
    entry_operator.append_text(ope)
  }
  if operator
    ind = WmiMonitoring::TESTOP.index(operator)
    entry_operator.set_active(ind) if ind
  else
    entry_operator.set_active(0)
  end

  entry_operator.set_size_request(150, -1)
  entry_operator.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_operator
  table.attach(label_operator,0,1,1,2)
  table.attach(bbox,1,2,1,2)

  entry_value = Gtk::Entry.new
  entry_value.set_text(value) unless value==nil
  label_value = Gtk::Label.new "Value"
  label_value.show
  entry_value.set_size_request(150, -1)
  entry_value.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_value
  table.attach(label_value,0,1,2,3)
  table.attach(bbox,1,2,2,3)

  label_sev = Gtk::Label.new "Severity"
  label_sev.show
  entry_sev = Gtk::ComboBox.new
  $status[0..3].each {|sev|
    entry_sev.append_text(sev)
  }
  entry_sev.signal_connect("changed") {
    entry_sev.child.set_background_gdk(@color_style[entry_sev.active])
  }
  ind = 0
  if severity
    ind = $status[0..3].index(severity)
    entry_sev.set_active(ind) if ind
  else
    entry_sev.set_active(ind)
  end
  entry_sev.child.set_background_gdk(@color_style[ind])
  entry_sev.set_size_request(150, -1)
  entry_sev.show
  bbox=Gtk::HButtonBox.new
  bbox.show
  bbox.add entry_sev
  table.attach(label_sev,0,1,3,4)
  table.attach(bbox,1,2,3,4)

  ok_button = Gtk::Button.new(Gtk::Stock::OK)
  ok_button.show
  ok_button.signal_connect("clicked") {
    if mode
      #here we just modify this service
      iter=@wmiview.selection.selected
      iter[1] = entry_wmiref.active_text
      iter[2] = entry_operator.active_text
      iter[3] = entry_value.text
      iter[4] = entry_sev.active_text
      addwmiwin.destroy()
    else
      if entry_value.text != ""
        #need to test if already exists
        error_detected=0
        @wmiview.model.each {|model, path, iter|
          if "#{iter[1]}" == "#{entry_wmiref.active_text}"
            error_detected=1
            break
          end
        }
        if error_detected == 0
          iter=@wmiview.model.append
          iter[0] = 1
          iter[1] = entry_wmiref.active_text
          iter[2] = entry_operator.active_text
          iter[3] = entry_value.text
          iter[4] = entry_sev.active_text
          addwmiwin.destroy()
        else
          errorEntry(addwmiwin, "WMI Ref already set")
        end
      else
        errorEntry(addwmiwin, "WMI Ref, you must set a value")
      end
    end
  }

  cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
  cancel_button.show
  cancel_button.signal_connect("clicked") {
    addwmiwin.destroy
  }

  bbox =Gtk::HBox::new(FALSE, 10)
  bbox.border_width=10
  bbox.show

  ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
  bbox.pack_start(ok_button, TRUE, TRUE, 0)
  cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
  bbox.pack_start(cancel_button, TRUE, TRUE, 0)

  vbox.add(table)
  separator = Gtk::HSeparator::new()
  separator.show
  vbox_root.pack_start(separator, FALSE, TRUE, 0)
  vbox_root.pack_start(bbox, FALSE, TRUE, 0)

  addwmiwin.show
end

#cell_jmx_attr_value_edited(cell, path_string, new_text, col, node, jmxattr_h) ⇒ Object



779
780
781
782
783
# File 'lib/gui/node_host_property.rb', line 779

def cell_jmx_attr_value_edited(cell, path_string, new_text, col, node, jmxattr_h)
	iter = @jmxtv.model.get_iter(path_string)
	iter[col] = new_text
	jmxattr_h[iter[0]].set_value(new_text)
end

#custom_monitor_cell_set_parameter(cell, path_string, new_text, col) ⇒ Object



3415
3416
3417
3418
# File 'lib/gui/node_host_property.rb', line 3415

def custom_monitor_cell_set_parameter(cell, path_string, new_text, col)
	iter = @customview.model.get_iter(path_string)
	iter[col] = new_text
end

#edit_monitored_jmx(node) ⇒ Object



1307
1308
1309
# File 'lib/gui/node_host_property.rb', line 1307

def edit_monitored_jmx(node)
	add_monitored_jmx(node, "edit")
end

#edit_monitored_serviceObject



1295
1296
1297
# File 'lib/gui/node_host_property.rb', line 1295

def edit_monitored_service()
	add_monitored_service("edit")
end

#edit_monitored_snmpObject



1299
1300
1301
# File 'lib/gui/node_host_property.rb', line 1299

def edit_monitored_snmp()
	add_monitored_snmp("edit")
end

#edit_monitored_snmptrapObject



1314
1315
1316
# File 'lib/gui/node_host_property.rb', line 1314

def edit_monitored_snmptrap()
	add_monitored_snmptrap("edit")
end

#edit_monitored_syslogObject



1311
1312
1313
# File 'lib/gui/node_host_property.rb', line 1311

def edit_monitored_syslog()
	add_monitored_syslog("edit")
end

#edit_monitored_wmiObject



1303
1304
1305
# File 'lib/gui/node_host_property.rb', line 1303

def edit_monitored_wmi()
	add_monitored_wmi("edit")
end

#fill_port_list(node) ⇒ Object



1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
# File 'lib/gui/node_host_property.rb', line 1362

def fill_port_list(node)

     #we need to append all monitored ports of service hash
     #@scanned_port_list is ordered as udp first and port number ...
     if node.service != nil
     if @scanned_port_list == nil
		  @scanned_port_list=[]
		  node.service.sort{|s1,s2| s1[0].split('/')[1].to_i()<=>s2[0].split('/')[1].to_i()}.each {|w,serv|
       	  str="#{serv.port} #{serv.protocol} "
			  @scanned_port_list.push "#{str} #{serv.name}"
		  }
	  else
   	 node.service.each_value {|serv|
      	str="#{serv.port} #{serv.protocol} "
      	if !include_regex_str("^#{str}",@scanned_port_list)
      	  # we need to add it correctly
			  plistbis=[]
      	  i=0
      	  for pt in @scanned_port_list
         	 ptt = pt.split(/ /)
         	 if ptt[1] == serv.protocol && serv.port.to_i < ptt[0].to_i
            	plistbis.push "#{str} #{serv.name}"
            	for port in @scanned_port_list[i..@scanned_port_list.size-1]
            	  plistbis.push port
            	end
            	break
         	 else
            	if ptt[1] != serv.protocol
            	  if serv.protocol == "udp"           
	            	 plistbis.push "#{str} #{serv.name}"
               	 for port in @scanned_port_list[i..@scanned_port_list.size-1]
                  	plistbis.push port
               	 end
               	 break
            	  else #its ptt[1] udp the first
               	 plistbis.push pt
            	  end
            	else
            	  plistbis.push pt
            	end
         	 end
         	 i+=1
      	  end
      	  @scanned_port_list=plistbis
		  end
			}
	  end
	end
end

#fill_port_view(node) ⇒ Object



1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
# File 'lib/gui/node_host_property.rb', line 1318

def fill_port_view(node)
	@treeview.show
	@vbox_ports.add(@treeview)
	 row_mon_port=[]
	 if @scanned_port_list != nil
   	for x in 1..@scanned_port_list.size
		  row=[]
		  plattr=@scanned_port_list[x-1].split(/[\ ]+/)
		  port=plattr[0].to_i()
		  proto=plattr[1]
		  name=plattr[2]

		  #we verify if we monitor this port
		  cbutton=0
		  if node.is_service_monitor(proto, port)
			  cbutton=1
		  end
		  if name == ""
			  service = "?"
		  else
			  service = name
		  end
		  sev = $status[node.get_service_sev(proto, port)]
		  @cbutton.push(cbutton)
		  row.push(cbutton)			
		  row.push(proto)
		  row.push(port)
		  row.push(service)
		  row.push(sev)
		  row_mon_port.push(row)
	  end
	end
   row_mon_port.each do |cb, proto, port, service, sev|
	  iter = @treeview.model.append
	  iter[0] = cb
	  iter[1] = proto
	  iter[2] = port
	  iter[3] = service
	  iter[4] = sev
	end
end

#get_snmptrap_refs_leftObject



1141
1142
1143
1144
1145
1146
1147
1148
# File 'lib/gui/node_host_property.rb', line 1141

def get_snmptrap_refs_left()
	snmptrap_ref_list=[]
	@snmptrapview.model.each {|model, path, iter|
		snmptrap_ref_list.push(iter[1].dup().to_s())
	}
	snmptrap_ref_list=SnmpTrapRef::get_snmptrap_refs_name()-snmptrap_ref_list
	return snmptrap_ref_list
end

#get_syslog_refs_leftObject



992
993
994
995
996
997
998
999
# File 'lib/gui/node_host_property.rb', line 992

def get_syslog_refs_left()
	syslog_ref_list_local=[]
	@syslogview.model.each {|model, path, iter|
		syslog_ref_list_local.push(iter[1].dup().to_s())
	}
	syslog_ref_list_local=SyslogRef::get_syslog_refs_name()-syslog_ref_list_local
	return syslog_ref_list_local
end

#include_regex_str(str, list) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/gui/node_host_property.rb', line 28

def include_regex_str(str,list)
	list.each {|str_lign|
		if str_lign.match(str)
			return true
		end
	} unless list == nil
	return false
end

#insert_jmx_attr_entry(node, jmxattr_h, mbean) ⇒ Object



874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
# File 'lib/gui/node_host_property.rb', line 874

def insert_jmx_attr_entry(node, jmxattr_h, mbean)
		if $jmx_refs[mbean.active_text].attribute.split.size > @jmxtv_nb_entry
iter=@jmxtv.model.append(nil)
val=""
$jmx_refs[mbean.active_text].attribute.split.each {|attr|
	if !jmxattr_h[mbean.active_text]
		val=attr
		break
	elsif !jmxattr_h[attr]
		val=attr
		break
	end
}
if val != ""
	#as we insert the attribute we blocked the mbean name
	mbean.set_sensitive(false)
	iter[0] = val
	iter[1] = JmxAttributeMonitoring::TESTOP[0]
	iter[2] = "0"
	iter[3] = $status[0]
	jmxattr_h[iter[0]]=JmxAttributeMonitoring.new(iter[0],0,iter[2],0)
	@jmxtv_nb_entry+=1
end
		end
end

#remove_selected_jmx_attr_entry(node, jmxattr_h, mbean) ⇒ Object



900
901
902
903
904
905
906
907
908
909
# File 'lib/gui/node_host_property.rb', line 900

def remove_selected_jmx_attr_entry(node, jmxattr_h, mbean)
	if @jmxtv.selection.selected
	    jmxattr_h.delete(@jmxtv.model.get_value(@jmxtv.selection.selected,0))
	    @jmxtv.model.remove(@jmxtv.selection.selected)
	    @jmxtv_nb_entry-=1
	    if @jmxtv_nb_entry == 0
	       mbean.set_sensitive(true)
	    end
	end
end

#scan_port_now(node) ⇒ Object

scan only one port



1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
# File 'lib/gui/node_host_property.rb', line 1435

def scan_port_now(node)
 if @treeview.selection.selected != nil
   iter = @treeview.selection.selected
   proto = iter[1]
   port = iter[2]
   msgbody = "#{proto.upcase}/#{port} seems down"
   #check if port is up
   if scan_port(node.ip, proto, port) == 1
     msgbody = "#{proto.upcase}/#{port} seems up"
   end
   dialog = Gtk::MessageDialog.new(@window, Gtk::Dialog::MODAL,
                    Gtk::MessageDialog::INFO,
                    Gtk::MessageDialog::BUTTONS_OK,
                    msgbody)
   dialog.set_icon("#{PIXMAP_PATH}/logo_icon.png")
   dialog.signal_connect('response') { dialog.destroy }
   dialog.show
 end
end

#scan_ports_now(node) ⇒ Object

scan all ports



1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
# File 'lib/gui/node_host_property.rb', line 1415

def scan_ports_now(node)   
	@scan_port_th=Thread.new {
		labelwait=Gtk::Label.new("Waiting scanning ports ...")
		labelwait.show
		@treeview.hide
		@vbox_ports.remove(@treeview)
		@treeview.model.clear()
		@vbox_ports.add(labelwait)
		@scanned_port_list=listport(node.ip).split(/\n/)
		fill_port_list(node)
		labelwait.hide
		@vbox_ports.remove(labelwait)
		labelwait.destroy
		fill_port_view(node)
 }
end

#snmp_contact(entry, node, read_community) ⇒ Object



2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
# File 'lib/gui/node_host_property.rb', line 2111

def snmp_contact(entry, node, read_community)
if $config.snmp_mon
   entry.set_text "(polling...)"
 Thread.start {
  	val=get_snmp_contact(node)
Gtk.thread_protect do
	begin
  			entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_contact for #{node.ip}: #{msg}")
	end
end
 }
else
	Gtk.thread_protect do
	begin
		entry.set_sensitive(false)
   		entry.set_text "(SNMP is disable)"
	rescue Exception => msg
		$log.debug("Exception in snmp_contact for #{node.ip}: #{msg}")
	end
end

end
end

#snmp_description(entry, node, read_community) ⇒ Object



2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
# File 'lib/gui/node_host_property.rb', line 2029

def snmp_description(entry, node, read_community)
	if $config.snmp_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_snmp_description(node)
Gtk.thread_protect do
	begin
	   	entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_description for #{node.ip}: #{msg}")
	end
end
 	}
else
Gtk.thread_protect do
		begin
		entry.set_sensitive(false)
	   	entry.set_text "(SNMP is disable)"
	rescue
		$log.debug("Exception in snmp_description for #{node.ip}: #{msg}")		
	end
end
end
end

#snmp_location(entry, node, read_community) ⇒ Object



2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
# File 'lib/gui/node_host_property.rb', line 2153

def snmp_location(entry, node, read_community)
if $config.snmp_mon
   entry.set_text "(polling...)"
 Thread.start {
  	val=get_snmp_location(node)
Gtk.thread_protect do
	begin
   		entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_location for #{node.ip}: #{msg}")
	end
end
 }
else
Gtk.thread_protect do
		begin
		entry.set_sensitive(false)
	   	entry.set_text "(SNMP is disable)"
	rescue Exception => msg
		$log.debug("Exception in snmp_location for #{node.ip}: #{msg}")
	end
end
end
end

#snmp_uptime(entry, node, read_community) ⇒ Object



2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
# File 'lib/gui/node_host_property.rb', line 2071

def snmp_uptime(entry, node, read_community)
if $config.snmp_mon
    entry.set_text "(polling...)"
 Thread.start {
 		val=get_snmp_uptime(node)
Gtk.thread_protect do
	begin
   		entry.set_position 0
		entry.set_text val
	rescue Exception => msg
		$log.debug("Exception in snmp_uptime for #{node.ip}: #{msg}")			
	end
end
 }
else
begin
	entry.set_sensitive(false)
  		entry.set_text "(SNMP is disable)"
rescue Exception => msg
	$log.debug("Exception in snmp_uptime for #{node.ip}: #{msg}")
end
end
end

#toggle_select_custom(path = 0) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/gui/node_host_property.rb', line 20

def toggle_select_custom(path=0)
	 @customview.model.each {|model, path, iter|
      fixed =iter[0]
      fixed ^= 1
      iter[0] = fixed
	}
end

#toggle_select_port(path = 0) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/gui/node_host_property.rb', line 10

def toggle_select_port(path=0)
    #switch all port
	 @treeview.model.each {|model, path, iter|
      fixed =iter[0]
      fixed ^= 1
      @cbutton[path.to_str().to_i()]=fixed
      iter[0] = fixed
	}
end

#wmi_boot(entry, node, login, pass) ⇒ Object



2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
# File 'lib/gui/node_host_property.rb', line 2272

def wmi_boot(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_boot_state(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
				entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_boot for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	Gtk.thread_protect do
 	begin
		entry.set_sensitive(false)
		entry.set_text "(WMI is disable)"
	rescue
	end
end
end
end

#wmi_description(entry, node, login, pass) ⇒ Object



2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
# File 'lib/gui/node_host_property.rb', line 2230

def wmi_description(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_description(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
			   	entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_description for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

#wmi_nbproc(entry, node, login, pass) ⇒ Object



2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
# File 'lib/gui/node_host_property.rb', line 2360

def wmi_nbproc(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_nb_proc(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
			   	entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_nbproc for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

#wmi_os(entry, node, login, pass) ⇒ Object



2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
# File 'lib/gui/node_host_property.rb', line 2446

def wmi_os(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_os(, pass, node.ip)
if val
	Gtk.thread_protect do
		begin
		   	entry.set_position 0
			entry.set_text val
		rescue Exception => msg
			$log.debug("Exception in wmi_os for #{node.ip}: #{msg}")
		end
	end
end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

#wmi_producttype(entry, node, login, pass) ⇒ Object



2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
# File 'lib/gui/node_host_property.rb', line 2489

def wmi_producttype(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_product_type(, pass, node.ip)
if val
	Gtk.thread_protect do
		begin
		   	entry.set_position 0
			entry.set_text val
		rescue Exception => msg
			$log.debug("Exception in wmi_producttype for #{node.ip}: #{msg}")
		end
	end
end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

#wmi_systype(entry, node, login, pass) ⇒ Object



2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
# File 'lib/gui/node_host_property.rb', line 2403

def wmi_systype(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_system_type(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
			   	entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_systype for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end

#wmi_thermal(entry, node, login, pass) ⇒ Object



2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
# File 'lib/gui/node_host_property.rb', line 2317

def wmi_thermal(entry, node,  ,pass)
	if $config.wmi_mon		
entry.set_text "(polling...)"
Thread.start {
 		val=get_wmi_thermal_state(, pass, node.ip)
	if val
		Gtk.thread_protect do
			begin
		   		entry.set_position 0
				entry.set_text val
			rescue Exception => msg
				$log.debug("Exception in wmi_thermal for #{node.ip}: #{msg}")
			end
		end
	end
 	}
else
	begin
	entry.set_sensitive(false)
	entry.set_text "(WMI is disable)"
rescue
end
end
end